How do I enable Eclipse/Java to handle special unicode characters - java

Do not know how to do the following: Using Java, Eclipse on a MacBook Pro running MacOs Mojave version 10.14 (also PostgreSQL), need to use special characters ç ś ṣ ṇ ṛ Ṇ ṃ ā ū √ and some French and German characters intermixed in both the Java code strings, output to GUIs, and input to forms. Have searched the internet and help files, but have not found anything that works.
Have unsuccessfully tried using Keyman; have not tried SLP1.
Do not know where in Eclipse or Java to set it up. Also, do not know how to do a plugin (if that is necessary).
From my Java program, using Eclipse, be able to easily insert special characters in display, print and accept them in input from GUIs.

Related

special characters from git to eclipse

So I am cloning some java files from git to eclipse. There are special characters like Ü è. letters you would see in the Spanish language that java normally does not like. When I open up the project in java it turns them into the square with the ? in the middle of it and java complains about it saying there is a special character problem. It wouldn't be that big of a problem but I'm doing it for work and there are A LOT of code and go through and a lot of special characters. Anything I can do about this to either make java like it or not change the characters when I go from git to eclipse?
(Assuming that when you say "I open up the project in java" you actually mean opening the project in Eclipse:)
You need to do two things: first figure out what the file encoding is, second change your settings so Eclipse would use that encoding. Figuring out the encoding can be troublesome. With a git remote repository on Unix the obvious guess would be UTF-8, with Windows UTF-16 would also come into my mind as a possibility. In worst case you can always open your file in a hex editor and check how are your special characters actually encoded. After that making Eclipse use that encoding is easy. (And you may consider changing it only for this special project of yours.)

JavaFx application in Windows is not displaying text correctly

So I have an application written in JavaFx 2.2 that has been packaged for linux, mac, and windows. I am getting a strange issue with some of the text fields though. The application will read a file and populate some labels based on whats found in the file. When run on ubuntu or mac we get a result like as you can see we have that special accent character over the c and it looks just fine. However in Windows it shows up like this . Any idea as to why this is happening? I was a bit confused as it is the same exact application on all three. Thanks.
Make sure to specify character encoding when reading the file, in order to avoid using the platform's default encoding, which varies between operating systems. Just by coincidence, the default on Linux and Mac happens to match the file encoding and produces correct output, but you should not rely on it.

Arab/UTF8 Characters in Swing/Java application on HP-UX v11.3 (B11.31)

I am confronted with a strange situation that I do not understand. I run a Java-Swing test application, that reads Arab-UTF8 hard-coded strings, builds a simple JXTable and shows the UTF8 strings on a column. The application is an executable jar that is run with command
java -cp test.jar org.test.MainTest
If there is a need I can attach the code of the application. The application shows Arab characters if run on Windows, or Mac but not HP-UX. We are talking about HP-UX B11.31 running jdk 1.7.0.0.05.
Please note that I checked the character settings at all possible levels on the HP-UX system. At Java level the default encoding is UTF-8 (file.encoding) and, at Swing level, the default font used by JXTAble (and enclosing panel) is Dialog and this font tested for a hard-coded arab string with method canDisplayUpTo(String x) returns -1 (all characters are displayable). I don't understand especially that, up to the moment the strings are fed into Swing, I manipulate only Java strings that are UTF8 compatible, or should be by definition.
Is anyone aware of HP-UX UTF8 encoding/decoding for Java/Swing? Is there something that escapes me, something that I should check? Any help will be greatly appreciated. Thanks.

Character encoding issues in Eclipse for Java using Webdriver

I'm currently using Eclipse with TestNG running selenium webdriver with java. I am using Jexcelapi to import data from OpenOffice (spreadsheet) to compare strings on the website i'm testing with values in the spreadsheet. The problem I have is that we have different regions including germany and Nordics (Sweden, Norway and Denmark). These sites have string characters with accents special characters. This is copied correctly on my spreadsheet and running the scripts in debug mode shows the correct character from the spreadsheet but when i get my results, it displays invalid characters such as ? and whitespace. I have looked through the forum and searched everywhere for the past few days and seen various solutions but none seemed to work. I'm not sure if the problem is with Eclipse, Jexcelapi or OpenOffice.
I changed the encoding settings in Eclipse to UTF-8 as advised in some places but still the same problem. I instantiated the class 'WorkbookSettings' and set the encoding and used it with my getWorkbook method and I still get those bad characters that make my scripts show failures.
Can anyone help with this please?
Thanks in advance
We had a similar problem when running webdriver on a remote machine and trying to paste text into forms. The tests were working on our development machines.
The solution was setting the environment variable
JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF8
After that the webdriver copied with the right encoding for swedish characters.

IntelliJ and internationalisation: accented characters

I have a java application which has a GUI in both English and French, using the standard Java internationalisation services. I wrote it in JBuilder 2005 on an old machine, and recently upgraded, which has meant changing IDEs. I have finally settled on IntelliJ.
However, it doesn't seem able to handle the accented characters in my ListResourceBundle descendants which contain French. When I first created the IntelliJ project and added my source (which I did manually, to be sure nothing weird was going on behind the scenes), I noticed that all the accented characters had been changed into pairs of characters such as é. I went through the code and corrected all of these, and assumed that the problem was fixed.
But I find on running the (rebuilt) project that the pairs of characters are still showing, instead of the accented characters that I see in my code!
Can someone who has done internationalisation in IntelliJ please tell me what I need to do to fix this?
PS: I'm on the Mac.
Two things --
First, make sure your files are being stored as UTF, and that your source control supports the encoding.
Second, consider using the resource bundle editing support built into IntelliJ http://www.jetbrains.com/idea/features/i18n_support.html
Java resource bundles should only hold ascii and Unicode escape codes
see [http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/].
e.g. \u00d6ffnen for German Öffnen.
The command line tool native2ascii converts from your native format to ascii plus unicode escape codes. It is a bit of a hassle but not an Intellij but a Java problem.
Note: I use Intellij on a Mac to create programs localized in English, German and Japanese.

Categories