1

I have a problem:

I copied more value (for example 23700 5000.2 0.000) from Excel file in a file .txt.

When I read in java this value stored in .txt file, and i copy this in another file .txt (with java), the result is the same:

23700 5000.2 0.000਍㈀㌀㜀㄀ ऀ㔀 㘀㜀⸀㜀ऀ ⸀㌀㌀㔀ഀ 23720 5067.7 0.670਍㈀㌀㜀㌀ ऀ㔀 㘀㜀⸀㜀ऀ㄀⸀  㔀ഀ 23740 5067.7 1.340਍㈀㌀㜀㔀 ऀ㔀 㘀㜀⸀㜀ऀ㄀⸀㘀㜀㔀ഀ 23760 5067.7 2.010਍㈀㌀㜀㜀 ऀ㔀 㘀㜀⸀㜀ऀ㈀⸀㌀㐀㔀ഀ 23780 5067.7 2.680਍㈀㌀㜀㤀 ऀ㔀 㘀㜀⸀㜀ऀ㌀⸀ ㄀㔀ഀ 23800 5067.7 3.351਍㈀㌀㠀㄀ ऀ㔀 㘀㜀⸀㜀ऀ㌀⸀㘀㠀㘀ഀ 23820 5067.7 4.021਍㈀㌀㠀㌀ ऀ㔀 㘀㜀⸀㜀ऀ㐀⸀㌀㔀㘀ഀ 23840 5067.7 4.691਍㈀㌀㠀㔀 ऀ㔀 㘀㜀⸀㜀ऀ㔀⸀ ㈀㘀ഀ 23860 5067.7 5.361਍㈀㌀㠀㜀 ऀ㔀 㘀㜀⸀㜀ऀ㔀⸀㘀㤀㘀ഀ 23880 5067.7 6.031਍㈀㌀㠀㤀 ऀ㔀 㘀㜀⸀㜀ऀ㘀⸀㌀㘀㘀ഀ 23900 5067.7 6.701਍㈀㌀㤀㄀ ऀ㠀㌀㘀㄀⸀㘀ऀ㜀⸀ ㌀㜀ഀ 23920 9577.0 7.372਍㈀㌀㤀㌀ ऀ㤀㔀㜀㜀⸀ ऀ㜀⸀㜀 㜀ഀ 23940 9577.0 8.042਍㈀㌀㤀㔀 ऀ㤀㔀㜀㜀⸀ ऀ㠀⸀㌀㜀㜀ഀ 23960 9577.0 8.712਍㈀㌀㤀㜀 ऀ㤀㔀㜀㜀⸀ ऀ㤀⸀ 㐀㜀ഀ 23980 9577.0 9.382਍㈀㌀㤀㤀 ऀ㤀㔀㜀㜀⸀ ऀ㤀⸀㜀㄀㜀ഀ

Can I eliminate this wrong character?

THX To all

2
  • I suggest you read the Excel file as an excel file. e.g. use the POI API Commented Apr 26, 2016 at 15:07
  • There is no text but encoded text. Not knowing the character set and encoding of a ".txt" file is data loss. When you do know, you specify it in your file/stream/whatever reader (usually, it's an argument to the constructor.) Commented Apr 26, 2016 at 23:27

1 Answer 1

1

Understand that today, text files are not all ascii. They can be utf-8, latin-1, utf-16, etc

The problem is likely that in your copying you are either opening the text file with the wrong text format, or writing it with the wrong text format. To open correctly, use

InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"utf-16");

substitute your file format for utf-16

For writing, use an OutputStreamWriter on a FileOutputStream

Sign up to request clarification or add additional context in comments.

1 Comment

I'm trying to think of a day when text files were ASCII. On the Digital Equipment Corp PDP-11 with the RSX-11 operating system, I think might they have been. (I didn't program in APL.) On my Corona Data Systems IBM-compatible PC with MS-DOS 1.25, they were CP 437. ╟Box drawing characters were really hot back then╢ (We still use them today in Windows tree /f)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.