Get file encoding in Java

Possible duplicate:
Java: how to determine the correct encoding of a stream encoding

The user uploads the CSV file to the server, the server needs to check whether the CSV file is encoded as UTF-8. If it is necessary to inform the user, he uploaded the wrong encoding file. The problem is that how to determine the downloaded file is UTF-8 encoding ? The back end is written in Java. So will anyone get an offer?

+3
source share
3 answers

, , , - , , - , . , , . , ISO 8859 ( ), ISO 8859 ( "" , , ).

. , , UTF-8 (EF BB BF), , , UTF-8. , , : 110xxxxx 10xxxxxx, , , , UTF-8. , - () UTF-8 enocded, - , ​​ 110xxxxx 110xxxxx. (110xxxxx , , UTF-8).

+3

Well, you can’t. You can show a “preview” (or should I say a review?) With some sample data from a file so the user can check if it looks good. Perhaps with the ability to select various encoding options to help determine the correct one.

0
source

Source: https://habr.com/ru/post/1764033/


All Articles