Well, can't point anything but that's how I make
everything works.
Main principal is
* keep all files UTF-8 with BOM marker
* Http reply is "Content-Type: text/html;
charset=UTF-8"
* I use UnicodeFileResourceLoader, new Velocity 1.5 is
going to have it out of the box.
But if you use Java resource bundles, you probably
can't use UTF8 .properties files. Java file readers
does not auto-recognize bom markers. True, so lame
classes really. UnicodeReader.java solves all
problems, but I don't know how to embed it to
ResourceBundle class.
I don't use Properties class at all. I save
.properties files as UTF-8_with_BOM, made own FileUtil
class to read name-value pairs to Map instance. I
consider core Properties class a flawed. I don't like
the way it wants to escape characters, its not a human
readable.
Map props = FileUtil.read("myconf.properties");
...
FileUtil.save(props, "myconf.properties");
What you should do is you told. Debug data as a hex
value or make simple equals test. Generate a simple
data from the .vm file with few accented characters.
Then in java side do "ABCÅÄÖ".equalsIgnoreCase(str)"
to isolate exact point when data went wrong.
You must have messed up encodings somewhere along the
pipeline.
https://issues.apache.org/jira/browse/VELOCITY-191
http://koti.mbnet.fi/akini/java/unicodereader/
http://koti.mbnet.fi/akini/java/java_utf8_xml/
This is how I write response streams.
byte[] bytes = data.getBytes("UTF-8");
response.setContentType("text/plain;
charset=UTF-8");
response.setContentLength(bytes.length);
response.getOutputStream().write(bytes);
response.getOutputStream().flush();
I have had zero character issues since made a pipeline
UTF8 enabled from point to point.
>>>>>>>
Hello Mailmur,
Thanks for your response.
It's really confusing to me how this thing works.
It appears that any data that I'm trying to pass via
.vm files are corrupted.
I've attached 2 images from the application.
The first image is a selection screen that is a plain
.html file. It is not going through Velocity and is
being displayed correctly.
When I select Spanish (for example) the second screen
is being populated by the MessageSource from within an
application (I have Message_xx_YY.resources file for
each language I support and these messages are
hard-coded within each file. The MessageResource code
just selects text from one of these properties and I
save it in the command Object which is then attached
to the ModelAndView object. In the .vm file I just
say:
#set($text = $comand.myText) for each label and
button.
Unfortunately that data is coming through corrupted as
you can see even though the browser shows encoding as
UTF-8.
I tried what you're suggesting
(request.setCharacterEncoding("UTF-8") but it did not
make any difference. I think it's my response encoding
that is corrupted.
I was thinking about looking at the Hex content of
these characters and trace it that way, but I don't
know how to display Hex_encoded characters.
Any Ideas?
I thank you ahead.
____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]