Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a java code that reads an excel file and writes it to a text file. When i get the output text file, I can see only symbols like this in the notepad. "‷搮ㄱ〱〰㄰㄰〠〰〠〰〠〰〠〰〠〰〠〰〠〰〠〰〠〰〠〰〠" But if i open the text file in wordpad or ms-word, the data is correctly displayed. What could be the error?

share|improve this question

migrated from Apr 20 '10 at 13:17

This question came from our site for professional and enthusiast programmers.

What's the encoding of the text? – Matt Ball Apr 20 '10 at 13:11

The error lies in using Notepad. Notepad uses the first couple bytes of a file to decide what the encoding is, you have to open a file with a specific encoding to read it properly.

Here's a link to learn ya:

Lesson learned: Don't use notepad.

share|improve this answer
Try notepadd++ as a free notepad replacement ( Very handy and knows how to handle encoding properly. Also does syntax highlighting for various languages and XML. – Tom Cabanski Apr 20 '10 at 13:15
or... output the encoding preamble to the file – Lasse V. Karlsen Apr 20 '10 at 13:17

It's quite likely that the first part of your data looks superficially like Unicode in a certain encoding (UTF-16). This has been a problem in past versions of Windows and can be read about in this article. However, I think since Windows Vista that particular issue was fixed.

A simple workaround would be not to use Notepad for that data.

share|improve this answer

You must log in to answer this question.