ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I wrote a java program that writes strings to a file. The strings contain foreign language characters. When I run the program in Windows, the output file shows the foreign characters. However, when I attempt the same operation in Linux, the output file shows a white question mark in a black background instead of the foreign characters.
The same Linux system could display the foreign characters if I copy the output file from Windows to Linux. I tried to create the output file using gedit that my program would then add additional strings to and chose Unicode-32 for encoding but still the same problem.
What could I do to get the program to display the foreign language characters from output text file?
It could be that the font you are using in your program doesn't have the characters to display some of your unicode characters. Whilst the font used in gedit does.
I don't use the program to display the characters. At the end when the program done writing to the text file, I open the text file to check the result. The text file opens in gedit. gedit could display foreign characters from the file generated on Windows but can't do the same for the file generated on Linux by the same program.
I checked the difference between the two files generated by the program on Windows and Linux. I found that the file from Windows has Western (ISO-8859-15) encoding. I then changed the encoding of the file on Linux hoping that it would fix the problem. The white question mark in a black background is no longer present but there are weird characters instead of the foreign characters. When I opened both files in Linux using gedit both of them used the same font, Monospace.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.