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.

Bug 94191 - Image, I18n: url property limited to ISO-8859-1 characters
Summary: Image, I18n: url property limited to ISO-8859-1 characters
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 5.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Gail Chappell
Keywords: RELNOTE
Depends on:
Reported: 2007-02-03 00:20 UTC by bugbridge
Modified: 2007-05-30 17:31 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description bugbridge 2007-02-03 00:20:43 UTC
Original status: 5-Cause Known; Suggested Status: NEW

Original Target Release: shortfin_dev; Suggested Target Milestone : 5.5

These items should be added to the Keywords: RELNOTE

Original submitter: edwingo

The file name appears correctly on the browser and in the log file, but the
image does not come up when the file name is mbyte.  Everything works fine when
only ASCII is used for the file name.

(by edwingo)
An I18n issue so I am requesting a waiver since we are at RC2 for the EN
release. I'll investigate and fix for a future release.

Evaluation (Entry 2):
(by edwingo)
The tutorial app stores the uploaded file contents into a new file with the same
name as the original name on the browser's system and then renders an image
component with a URL set to that file. This works for ASCII, but not in general.
Here's why, on post-back, the file name is encoded in UTF-8 (usually). On the
server, a file with that same name is used to hold the contents. Then an image
component is used with its URL property set to that same UTF-8
original-file-name. The image component tries to render something like <img
src=".../orignal-file-name"/>, but the rendering is messed up because it
contains UTF-8 chars. When the browser fetches the image src, it is not found so
the space is left blank. Based on comments in the code, it appears that JSF is
supposed to properly escape the file name according to specified URL encoding
rules but does not. I haven't checked the JSF spec. So I see some options:

1) Fix this bug in the JSF RI
2) Change the app so that it only uses URLs with ISO-8859-1 chars
3) Change the app by writing to a fixed file name

I think #3 is easiest. I haven't spent time figuring out what is the specified
behavior for the URL property of an image component. Was it intended to contain
UTF-8 chars? I think there are newer WWW specs in the works that allow for IRIs
that map them to URIs using UTF-8, but I don't know if it is widely implemented
yet. So I would recommend #3 or #2. I've tested that #3 works.

I'll re-assign this to tutorials and who I think is the RE. I'll also see if #1
is possible, but that will take some time for it to be implemented. Also, older
apps will still not work so I think that we should still change the tutorial app.

Evaluation (Entry 3):
(by gchaps)
edwingo gave me these fixes for the tutorial, which I am in the process of
updating and testing:

1) Add a constant in the java code:

   private static final String IMAGE_FILE_PATH = "/resources/image-file";

2) Modify prerender to something like:

   public void prerender() {
       String uploadedFileName = (String) this.fileNameStaticText.getValue();
       if ( uploadedFileName != null ) {

3) Modify the button action method to something like:

               String realPath =
               File file = new File(realPath);

4) You no longer need to create the "images" subdirectory of the "resources"
directory so this step of the tutorial can be removed.

5) You may need to edit other parts that refer to the "resources/images"
directory in the code and tutorial.

Evaluation (Entry 4):
(by edwingo)
This is really a bug in the JSF RI so I created the following bug The problem is
that the tutorial app can use an Image component with a "URL" property value
that contains non-ISO-8859-1 characters. This happens when the orignal filename
of an uploaded file contains UCS characters. The "src" attribute of the "img"
tag is not rendered correctly so when the browser fetches it, it gets a file not
found error and so nothing appears in the browser window. The workaround is to
have the app limit the URL property to ISO-8859-1 characters. For example, there
can be a separate translation step from ISO 10646 UCS chars to ISO-8859-1 chars
or maybe the app can avoid using UCS chars altogether which is what I recommend
for the tutorial app.

This is *independent* of the File Upload component. For example, you can create
an image file with a name containing non-ISO-8859-1 characters and set the "url"
property of an Image component and get the same behavior. No File Upload is
Comment 1 Matthew Bohm 2007-02-03 00:25:24 UTC
Comment 1:
Please see:

It has also been reported on Chinese and Japanese Creator forums.  It is a
fairly visible component that our customers use and many are seeking for a solution.

Comment 2:
Here are the steps to reproduce:

Follow the tutorial at

You don't need to put the labels but you want the rest of the components to be
there with the proper id's, as they are used in the code snippets.

You will see that when navigating to a mbyte file name, the image does not
appear.  The file name appears correctly after the fix for xxxxx.

Tested using the following configurations and the behaviour is the same for all.

1.  Glassfish / J2EE 1.5 container
2.  AS9U1 ML / J2EE 1.5 container
3.  Bundled Tomcat 5.5.17 / J2EE 1.4 container
Comment 2 Gail Chappell 2007-02-08 19:13:37 UTC
The tutorial has been updated to write the uploaded file to a fixed filename. 
If you see February 2007 in the dateline, then you are reading the updated tutorial.
Comment 3 Ken Frank 2007-05-30 17:31:45 UTC
based on comments below, am verifying.