i have a program that insert arabic language to ms access when i create .jar file for the program and move it to another computer and run the jar file it store the arabic data in the ms access database like that ?????.
note: you must know that when it run in my computer it stores the arabic correctly.
Thanks in advance
Is it possible for your to copy the Access DB file from that computer and open in up on your computer? Does it still show ??? or does it display the data correctly? Since you say it works on your box, this seems like a case of missing font pack/regional pack or something along those lines.
my point is: have you tried on the other computer on which you want it to work?
as ~s.o.s~ says, it depends on the computer on which you'll try, so: will it work on each and every computer in the world? well, doubtful, will it work on a number of computers around you? very well possible.
Well, that's one issue then. When you store data from your machine, the default encoding of the machine is used because of which everything works out well. But when you run your app on a machine which has a different encoding (i.e. non-arabic), you end up storing arabic data with a non-conformant encoding hence the garbage characters.
Just to confirm: can you copy over your Access DB file to the users computer and try opening it up there. Does it still show as ????
The real solution would be to manage the encodings explicitly (preferably using UTF-8) when inserting/querying db data. As a hack, you can try setting the JVM encoding using the tricks mentioned in this thread. Instead of using UTF8, use windows-1256 (or Cp1256 if it doesn't work).
Have you tried out the JAVA_TOOL_OPTIONS trick? It doesn't matter whether you add it to the user or the system variable tab. Also read the original link I posted thoroughly so that you know what should be the value for JAVA_TOOL_OPTIONS.
i almost tried all the suggestion that is mentioned in the link you gave me but there is no result except the JAVA_TOOL_OPTIONS but i need a way through code because the pragram will be in jar format when i will give it to multiple computers so is there is a way???
how can i pass the -Dfile.encoding=Cp1256 when starting up Java process.
How does the user currently open up your application? I'm assuming via a .bat file? The idea is to modify the Java command line used. For e.g. if your command line is java -jar SomeAppJar.jar, then modify it to something like java -Dfile.encoding=Cp1256 -jar SomeAppJar.jar.
When does this happen; when you run it on the user's PC or on your PC? If you are trying this on your user's PC, can you also try it on your PC? Also, print out the method output for the methods mentioned here in both the cases.
There isn't much I can do sitting here unfortunately. One last thing you can try is to explicitly set the encoding when getting the connection. I'm assuming you are using JDBC-ODBC bridge driver. Put the following key-value pair in properties before passing it to getConnection: prop.put("charSet", "Cp1256"); or prop.put("charSet", "utf8"); as mentioned here.
EDIT: Also, are you sure Arabic characters can be displayed on the user's computer? How are viewing this data on users computer (i.e. directly in MS Access or in some application which you have written)? Can you send across a text file containing arabic data to the user's computer and check if the user can actually view it?
i use this way it changes the writing from ???? to something like this áÊÇá so i am thinking could i use something other than Cp1256 and utf-8 ???
or the problem could be in the jdk and jre i use ???
thanks in advance