hi all,
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

Recommended Answers

All 40 Replies

have you tried?

Yes of coures when i run it in my computer it store arabic words perfectly but when i created jar file and move it to another computer it stores the arabic words like this ????

if you had tried, you would have known.

sorry but i do not understand you i would know what exactly ????

you mean when you say do you tried?

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.

HI
when i copy the database table from the computer that arabic words apper like this ???? to my computer the words still apper like ????? is there is a way to solve it ?
thanks in advance

my guess: you'll have to look into character encoding.

and where to look into character encoding and how to do it ????

Does your box/Windows installation have Arabic set as the default language? Are you explicitly setting any sort of encoding in your code when writing/storing data in Access?

yes, no i do not use any sort of encoding in my code

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 ????

when i copy my access database and open it in the user computer it show arabic normaily

What does System.getProperty("file.encoding") and Charset.defaultCharset() print on your and the user machine? Are the values different?

in my computer it appear windows-1256 for the 2 values
in the user computer it apper utf-8

i think i should change the jre encoding but i do not know how to do it do not you agree????

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).

thanks for replay but i open environment variable but i couldnot find the JAVA_TOOL_OPTIONS variable do you want me to add it to the user variable or to the system variable ???

thanks in advance

thanks for replay but i open environment variable but i couldnot find the JAVA_TOOL_OPTIONS variable do you want me to add it to the user variable or to the system variable ???

Yes, you'll need to create this entry. If this doesn't work out, try passing -Dfile.encoding=Cp1256 when starting up Java process.

thanks for replay
how can i pass the -Dfile.encoding=Cp1256 when starting up Java process.
did you mean that i should create the entry in system variable????

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 i write the variable it converts the word to something like that áÊÇá when i use Cp1256
and when i use utf-8 it convert it to something like this اتانا

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.

when i run it on the user pc
when i make it in my computer utf8 it apper ظٹظ†ظ…طھط¨ظ†
when i make it in my computer Cp1256 it apper correctly
could you please help me to solve the problem??
thanks

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.