standard encoding of files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

standard encoding of files

Adam Heath-2
Back in December, I fixed groovy class parsing/caching.  To do that, I
introduced UtilIO.readString, to read an entire file into a stream.
However, the implementation wasn't the best.  It uses the single-arg
InputStreamReader.  What that means is that it uses the default
platform charset for converting the bytes to characters.

This is an issue.  When we(ofbiz developers) create the groovy files,
we end up using whatever the default is for each system, commit to
svn, and then have it checked out onto some other system; cue the clowns.

I'm suggest that I'll modify UtilIO.readString, to force the encoding
to always be UTF-8, which is the only sensible thing to do.  This
would mean all files would now have a sane encoding(at least, *.groovy
to start with).

ps: I should have broached this subject when I added UtilIO; we had
this same problem with webslinger, and I went to great pains to force
UTF-8 in all places.
Reply | Threaded
Open this post in threaded view
|

Re: standard encoding of files

Christian Geisert
Adam Heath schrieb:

[..]

> I'm suggest that I'll modify UtilIO.readString, to force the encoding
> to always be UTF-8, which is the only sensible thing to do.  This
> would mean all files would now have a sane encoding(at least, *.groovy
> to start with).

Or just use ASCII and unicode escaping if necessary.

Christian
Reply | Threaded
Open this post in threaded view
|

Re: standard encoding of files

Adam Heath-2
Christian Geisert wrote:

> Adam Heath schrieb:
>
> [..]
>
>> I'm suggest that I'll modify UtilIO.readString, to force the encoding
>> to always be UTF-8, which is the only sensible thing to do.  This
>> would mean all files would now have a sane encoding(at least, *.groovy
>> to start with).
>
> Or just use ASCII and unicode escaping if necessary.

groovy was just an example; the method in question is supposed to be
used by multiple places.