This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | I18N - quickstart-webapps.html does not have code/info on using non english characters/encodings | ||
---|---|---|---|
Product: | www | Reporter: | Ken Frank <kfrank> |
Component: | Obsolete | Assignee: | Jeffrey Rubinoff <jeff_rubinoff> |
Status: | RESOLVED WONTFIX | ||
Severity: | blocker | CC: | geertjan, jbranam, kaa, tgiunipero |
Priority: | P3 | Keywords: | I18N |
Version: | 6.x | ||
Hardware: | Sun | ||
OS: | All | ||
URL: | http://www.netbeans.org/kb/55/quickstart-webapps.html | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | sample project |
Description
Ken Frank
2007-11-15 18:14:36 UTC
I've forwarded this to the feedback alias for that URL. That tutorial would be the wrong place, because that one needs to be as short as possible since it is a quick start. This one would be a better place, since it already contains info about internationalization. I need to update it to 6.0. Please tell me exactly what needs to be added/changed from your perspective: http://www.netbeans.org/kb/55/tutorial-webapps.html since not developer can tell high level view of what needs to be added to tutorial; note that the i18n part in the midnite tutorial is about i18n related to messages, whereas this topic is about use of multibyte or non ascii, regardless if an app is i18n'd for messages. also, perhaps the context of the default created servlet or jsp in netbeans could be used as a reference as to what additonal code/steps need to be added to the steps in this tutorial (midnite) that is, it seemed the problem in original tutorial of quickstart-webapps was in the form items not allowing or processing of mbyte properly, since that I am guessing involves additional communication with the server ? so that could be focus of addtional things in this tutorial. But is there ui in this tutorial that involves forms in same way as the quickstart tutorial ? (and is coded the same way) if so, then suggest trying this midnite tutorial so see if it handles the non ascii ok, but would need some finished tutorial project and location of applicable code to try this - would not be able to run tutorial itself now. ken.frank@sun.com Please, keep the quick start quick. This subject matter is wrong for the quick start. I was not referring to having additions to quickstart, but to the tutorial you mentioned http://www.netbeans.org/kb/55/tutorial-webapps.html ken.frank@sun.com Perfect. Finding the right place will, as you said, is the next step. We'll get back to you once we start working on updating the tutorial for 6.0. Ken, pls use the URL field if you are referring to a specific page. I added the current URL based on your initial report : "the quickstart-webapps.html tutorial for nb55". It sounds like that's no longer (or never was) the right value, pls update as appropriate. Thanks. I don't know what the url should be; I think its ok with decision of docs team as to which tutorial would be best to add this information to. Can someone in docs team modify the url to the correct one ? ken.frank@sun.com It's not clear to me what exactly needs to be added. Here are twon tutorials for 6.0. One is the web quick start the other is the full blown web tutorial. Please do the following: 1. Look at both these tutorials. 2. Choose the one where your information should be added. 3. Write that information, preferably as few steps as possible. 4. Put that information into this Issuezilla thread. 5. Then I will add it to the tutorial of your choosing. Here are the two: http://www.netbeans.org/kb/60/web/quickstart-webapps.html http://www.netbeans.org/kb/60/web/tutorial-webapps.html Again, you can choose. However, you must do the writing of the additional steps and indicate where they should be added. I don't know at a low level what the info should be; I'd assumed that is part of the request and that those writing tutorials would add it just as other info is added; but I don't really know process of how tutorials are written and by whom. You mention I need to provide the code and steps; is that true for all tutorials that they are written by developers or others not in docs ? This is just based on the comments in closed issue 102911 and as mentioned below as per 102911, the tutorial does not provide code or info related to user who might want to add non english to the app or to run in another locale or use another encoding, and it does not work completely as per 102911. and in that issue, developer says: This is not NetBeans issue - the fact that JA text is not properly shown is because tutorial code is basic and simply does not handle that. in this case user followed <http://www.netbeans.org/kb/55/quickstart-webapps.html> tutorial so that's the place which could be improved. Re. examples - web comes with 'Servlet Examples' sample project which contains (besides other things) filter/SetCharacterEncodingFilter.java class which perhaps should be used from tutorial and that would make the application run smoothly with non-european charsets. However what that code or related info is, I don't know. But I think that the info needs to cover about an app like in the quickstart, that used buttons on the page for submission, since it seems the problem was in that flow of information from app to server and back, rather than just showing non ascii on the main jsp page text. ken.frank@sun.com Yes, it is normal that if you want to change a tutorial, you specify what should be changed. Please provide the information and I will make the change. If you don't know, feel free to say so, point me to someone else, and I will find out from them. Somehow, I need the information. Right now, I don't have it. sounds fair. Andrey (kaa) will provide the information. ken.frank@sun.com I checked http://www.netbeans.org/kb/60/web/quickstart-webapps.html (updated ver. for 6.0) Used mbyte everywhere. The issue 102911 still reproducible in Mozilla and IE. I would suggest to replace getName method (see Generating Getter and Setter Methods section) with the following implementation: public String getName() { try { return new String(name.getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException ex) { Logger.getLogger(NameHandler.class.getName()).log(Level.SEVERE, null, ex); } return name; } I will take a closer look at this when I perform a more thorough 6.0 update (Jan/Feb). Ken, looks like a good solution. Troy, I suggest you add that method below the existing implementation of that method, and then explain the necessity of implementing it that way. So, keep the original method, add this one in the next step, and explain its reasoning. My 2c. I think this is a great improvement, thanks Ken. credit for info and research goes to Andrey (kaa), not myself (Ken); Andrey is our i18n testing team j2ee/webapps/enterprise specialist. I'll ask Andrey to provide attachment with the added code, in case we want to amend this app or provide another one, in this or another tutorial. ken.frank@sun.com Created attachment 55082 [details]
sample project
Ken, I've gone through the tutorial. Unfortunately though, I think that adding the code that you've provided would not be good for the document. My reasons are as follows: 1. As Geertjan originally pointed out, this is a quickstart tutorial, and meant to provide a very basic and direct set of instructions. IMHO, adding the code snippet, and explaining why, would detract from this. 2. The suggestion that Andrey makes (i.e., to replace getName method in Generating Getter and Setter Methods) will prevent, or restrict, the tutorial from demonstrating that the IDE can automatically generate getter and setter methods for a JavaBean. Also, AFAIK, creating accessor methods for a JavaBean in the manner currently provided is common, accepted practice. It is what someone would expect upon visiting an introductory tutorial for the IDE. I really think the best place to address this issue would be in the more advanced Web Application tutorial (http://www.netbeans.org/kb/60/web/tutorial-webapps.html). I will soon be reworking and expanding the tutorial into 3 closely related tutorials that address development, profiling (and poss. debugging), and localization. Encoding issues could be discussed somewhere here (which we could spend more time collaborating on). May be adding trouble shooting section (or Enabling internationalization) with this code will improve the sample? from Troy's comment: I really think the best place to address this issue would be in the more advanced Web Application tutorial (http://www.netbeans.org/kb/60/web/tutorial-webapps.html). I will soon be reworking and expanding the tutorial into 3 closely related tutorials that address development, profiling (and poss. debugging), and localization. Encoding issues could be discussed somewhere here (which we could spend more time collaborating on). - sounds like a good plan; Andrey can work with you on it. also, Andrey's suggestion about having a troubleshooting section in which it could mention, that there will be additional tutorials discussing more about i18n. ken.frank@sun.com I hadn't even considered the idea of a Troubleshooting section. This could work well for situations in which a user steps through the tutorial properly, then finds that the project doesn't compile or run due to encoding issues. NB 6.0 uses UTF-8 by default however, so I'm having difficulty understanding why this would even happen - unless the user has deliberately changed either project or file encoding. And just to clarify, the problem only arises when a user wants run the project in a locale other than that in which it was created, or use an encoding which conflicts with the characters provided in the tutorial's sample code? I'm concerned that if encoding sample code and corresponding explanation are introduced here for these reasons, then according to this logic it would be necessary to include similar content in nearly all tutorials. As far as I understood this problem came from App Server. Looks like it assume that the request encoding is ISO-8859-1 instead of UTF-8. Thats why It could happen in any locale. Following up on Ken's comment about troubleshooting: "also, Andrey's suggestion about having a troubleshooting section in which it could mention, that there will be additional tutorials discussing more about i18n." Could you please provide me with a bulleted list of all the possible (or most likely) scenarios in which encoding issues could cause problems for the user in this tutorial? (If this info isn't used here, it most likely will be in the midnight cookie tutorial.) I found collection of this staff here http://tagunov.tripod.com/i18n/i18n.html Didn't check them all yet Apologies for leaving this issue for so long. Ownership of the web app quickstart tutorial is about to be turned over to James Branam, a colleague in Docs. However, to address this issue, I'd like to add a troubleshooting section and provide a link to a sample working project. Over the past 3 months, I've noticed enough questions and problems on the feedback alias to warrant this. For Troubleshooting topics, I was thinking of the following: Note that the first point addresses users who aren't using updated software. Ken, would you please have a look and add/remove questions as you see fit? Also, could you provide (or have engineers provide) a response to these? 1. "I've built and run the project. When I click the OK button for index.jsp, the next page indicates that response.jsp is not available." Are you using JDK version 5 or higher? Choose Help > About from the main menu to verify the JDK version the IDE is using. Are you using Tomcat version 5.x or higher? Choose Tools > Servers from the main menu. Select the server that the project uses and note the entry for Server Type displayed near the top of the dialog. You can also try downloading and running the sample project in your IDE. 2. The project does not build. I am using an encoding other than UTF-8. What to do? 3. How can I get the get the application to understand a different alphabet? 4. When I input non-English characters in index.jsp's text field, the same characters do not render properly in result.jsp. How can I get this to work? Also, looking at the sample code provided above for getName(), wouldn't this only work for the ISO-8859-1 encoding? I.e., wouldn't it be necessary to pass to the method the specific encoding you require? Reassigning to James, who now covers Web App tutorials. Removing meaningless "version"s for www issues. It's talking about 55 stuff and it's years old. If there's still a problem, someone file a new bug. |