I have text file, how can I know the text in the file is in UTF8 standard or Mac OS Roman
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For a single file, the practical move is to open it e.g. in a web browser and test, via the browser’s View menu, how it looks like in the two encodings. If the encoding matters (i.e., there are characters outside the Ascii range 0–127), you should normally see the difference at once (at least if you can read the language of the document).
In programming, if you need to set up a general tool for resolving such questions automatically, it’s probably best to try to read the file (using your favorite programming language and tools) in the two encodings and check the success. If both ways give success, check out whether it can be read as Ascii too – if it can, the answer is trivial (the file is both UTF-8 and MacRoman encoded), and if not, you need some extra logic. In principle, inspection of the content is needed then, since the data can be interpreted both ways at the encoding level and only the content resolves which interpretation is correct.