cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Flowscript encoding weirdness and a solution
Date Fri, 11 Mar 2005 20:42:36 GMT
Stefano Mazzocchi wrote:

> Sylvain Wallez wrote:
>
>> Hi all,
>>
>> I encountered some weird things with a flowscript containing strings 
>> with accented characters, saved in UTF-8. This is because the flow 
>> interpreter uses the platform's default encoding to read script 
>> files. And of course this default encoding isn't the same on Windows 
>> and Mac...
>>
>> To solve this, I added the possibility to specify the file's encoding 
>> as a comment in the very first line of the script, e.g.
>>
>>  // encoding = UTF-8
>>  function blah()
>>  ...
>>
>> If no special comment exists, we fall back to the platform's default 
>> encoding as of today.
>>
>> This works beautifully, and I'm thinking of adding this to 2.1 even 
>> if (or especially because) the release is coming soon.
>
>
> how about
>
>  //@ encoding = UTF-8
>
> instead? so that we can discriminate between comments and 'metadata 
> comments'?


Or even a more javadoc-like

// @encoding UTF-8

However, just like <?xml encoding="..."?>, this comment must appear on 
the _first_ line, as a PushbackInputStream is used to re-read the script 
with the correct encoding and therefore we cannot do some complicated 
parsing to determine the encoding.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message