Thursday, October 2, 2003, 12:49:04 PM, mailmur wrote:

>>  Daniel Dekany
>> But anyway, I think that controlling output encoding
>> in template is
>> usually not a good practice. And, I tend to think
>> that the safest is if
>> you just use UTF-8 as output encoding everywhere...
>> no "?"-s.
>
> This is what I encountered and had a minor problem in
> Win2k environment (if template is ever saved with
> Notepad UTF8 format). Win-notepad will add UTF8 bom
> marker (3 bytes) at the start...which is a very good
> as programs can transparently handle several encodings
> without an user interaction.
> If velocity is used to generate html files
> (text/html), then extra ? character is not displayed
> at the webbrowser. Maybe browsers recognise the bom
> and will skip it.

I feel some confusion here. The thing is that Win2K/XP Notepad adds a
BOM character (UCS code FEFF) at the beginning of the file (with UTF-8
encoding, if save with that). That character can be superfluous here (as
HTTP has charset given in the content-type header, it doesn't need
auto-detection), also some UNICODE aware software doesn't understand
what's that BOM there (as Opera Web browser, and it seems, Sun Java
platform impl.), but it is still a plain simple character there. So if
your *output* encoding is UTF-8, and also Velocity uses UTF-8 *input*
(template) encoding, then that must not become to '?'. You see, that's a
legal UTF-8 encoded character, so it must remain what it was originally,
if the output and input encoding is the same...

> But generating "text/plain" from Notepad-UTF8 saved
> velocity template will output ? character as first
> character.

I suspect either your input or output encoding is not UTF-8.

> My unicoderesourceloader has a standalone testprogram to see it
> happen.

The resource loader should automatically interpret and remove leading
BOM, as some software is confused on the leading BOM...

-- 
Best regards,
 Daniel Dekany



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to