0 0 Votes

Question Marks (?) instead of Persian Characters in .txt File

Question by Guest | 12/06/2019 at 07:55

I exported content of a 2-column bilingual (English-Persian) Excel 2010 file to a tab-separated text file. But the content of the second column in the .txt file instead of being in Persian just shows a number of question marks (?) for the Persian words. How can I fix this?

Thanks a million in advance for your help.

ReplyPositiveNegativeDateVotes

Stefan Trost

Show Profile | Message
Avatar
00 Votes

That can happen, if the encoding of the text file is not capable of storing the characters. Then the characters that can not be stored are stored as ?. Probably, you are saving your text file in ANSI format, which can only differ between 256 characters. That are for example the characters from A to Z and a to z but not Persian characters.

What you need is a Unicode format such as UTF-8 which is capable of storing all characters. Depending on your Excel version, you can find the corresponding settings in the storage dialog left to the save-button. In some Excel versions, you can set up the encoding there directly, in other Excel versions, you have to click on "Tools" > "Web Options". I recommend using the format Unicode (UTF-8).

If you want more background information about that, you can get information about the ANSI format or other Unicode formats.
12/06/2019 at 15:05

ReplyPositive Negative
00 Votes

Thank you dear Stefan,

You're right. I made the changes in my Excel file as you said. But, when I save the Excel file as a tab-separated text file, the resulting .txt file is still in ANSI format with the problem of question marks instead of Persian character. How can I change the .txt file to a Unicode Text (.txt) file?

Thanks a million in advance for your help.
12/06/2019 at 15:58

Positive Negative

Stefan Trost

Show Profile | Message
Avatar
00 Votes

Have you changed the encoding in the save-dialog of Excel? The default is a Windows ANSI encoding here and if Excel is not saving your decision, you have to change the settings every time you want to save your CSV.

If you want to change the encoding of an existing file, you can use the program TextEncoder. However, if there are one time question marks in the file, the information about the original characters is lost, because there are only the same questions marks left for each original character and cannot reconstruct what character a question mark had been before.
12/06/2019 at 16:04

Positive Negative
00 Votes

Hi again dear Stefan,

In the Save As dialog window here there is no any option for choosing an encoding whatever. I set the “File > Options > Advanced > General > Web Options > Encoding > Save this document as:” to “Unicod (UTF-8)”. Then, Save As > Save as type: Unicode Text (*.txt) and the result is ideal.

The question now is that how I can make Excel always automatically save in Unicode without needing me to go through the steps said above.

Thank you again for your help.
13/06/2019 at 06:36

Positive Negative

Anja Proggy

Show Profile | Message
Avatar
00 Votes

Unfortunately, Excel does not have an option to set up a default character encoding there.

I don't know why the developers of Excel could forget that.
13/06/2019 at 20:17

Positive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own articles on askingbox.com. How to do.