Any ideas how to determine an encoding by file content?

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Guillaume Laforge" <[EMAIL PROTECTED]> wrote in message
ah1de7$fec$[EMAIL PROTECTED]">news:ah1de7$fec$[EMAIL PROTECTED]...
>
> Hello,
>
> I would like to suggest an improvement to IntelliJ's UTF-8 handling...  It
> should try *detecting* the encoding, it shouldn't globally *assume* an
> encoding (even if it's parametrable).
>
> Might be worth implementing a low-level input stream, that reads just
enough
> bytes to determine the encoding, which is wrapped by an InputStreamReader.
> The low-level input stream wouldn't pass on any data to the "wrapper
reader"
> until the encoding's known.  Either that or a blocking method, such as
> readEncoding(), returning UTF-8, ISO-8859-1, or whatever, on the low-level
> input stream.  Once the method returns, wrap the low-level stream with the
> appropriate InputStreamReader (you'd now know which value to use for the
> reader's "encoding" parameter...), then read the information to the end of
> the file.
>
> Guillaume
>
>


_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://lists.jetbrains.com/mailman/listinfo/eap-features

Reply via email to