velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Dekany <ddek...@freemail.hu>
Subject Re: Difference in behaviour between Solaris and Win32 regarding ShiftJIS templates
Date Thu, 07 Nov 2002 11:03:32 GMT
Thursday, November 7, 2002, 1:12:25 AM, Brett Joseph Morgan wrote:

[snip]
> A problem: It appears, from testing, that Sun's character conversion
> charts for Shift-JIS <=> UTF-16 are not perfect, with some characters
> being converted into ?'s on the round trip.
[snip]

I don't know Shift-JIS charset, but I guess that since it is an
important charset, it should be convertible to UCS and back without
loss. And if so, it's pathetic if the Sun implementation (AFAIK uses
IBM's ICU) does this converting wrongly. Are you really sure you tried
to do the round trip conversion on the right way?

> A workaround: Do not do any character conversions, treat the character
> streams as byte streams, and hope for the best.
>
> The cautionary tale: The above workaround works flawlessly on Solaris
> using both jdk 1.3.1_01 and jdk1.2.2, but fails miserably on Windows
> 2000 using jdks 1.2.2, 1.3.1_06 and 1.4.1_01.
[snip]

My tip:
I guess the cause of problem is that you don't specify the charset
when you call getTemplate, thus Velocity uses the input.encoding in
velocity.propertyes. This is probably ISO-8859-1, which differs from
the default encoding used by Windows with US locale (CP1252). And
since you call String.getBytes(), you basically do
ISO-8859-1 -> UTF-16 -> CP1252, which is often not possible without
loss. (The default charset on Solaris (with US locale is) ISO-8859-1,
so the problem does not occur there.)


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message