File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Unicode Arabic to \uXXXX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unicode Arabic to \uXXXX" Watch "Unicode Arabic to \uXXXX" New topic
Author

Unicode Arabic to \uXXXX

Deepan Devadasan
Ranch Hand

Joined: Jan 25, 2007
Posts: 226
Hi..

How can i convert Unicode Arabic strings to \uAD04 format...

I need this to do a search in the Oracle DB that has Arabic data...

search string is also entered as Arabic characters...

Thanks in advance


Theepan Thevathasan
SCJP 1.4, SCWCD 1.4, SCMAD 1.0 SCBCD 1.3, MCP(.Net Frm 2.0 App Dev Fdn)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Java supports Unicode. Oracle supports Unicode. Why would you need to use the Unicode value at all?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Deepan Devadasan
Ranch Hand

Joined: Jan 25, 2007
Posts: 226
Meaning...I can directly do the transferring in and out ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18563
    
    8

I don't see why a straight Unicode solution shouldn't work. I am surprised you didn't try that first. And I don't see why Oracle's database would interpret Java Unicode escape sequences in the same way the Java compiler would; but I don't know Oracle and stranger things have been done.
Deepan Devadasan
Ranch Hand

Joined: Jan 25, 2007
Posts: 226
Hi...

Answer found out...

UTF-8 can be used straight away...

But there is a trick... request.setCharacterEncoding("UTF-8");

Thanks to Java
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Theepan Thevathasan:
Hi...

Answer found out...

UTF-8 can be used straight away...

But there is a trick... request.setCharacterEncoding("UTF-8");

Thanks to Java


What happens if the client has already set Character Encoding header to some encoding other that utf-8 ?

Even the serlvet specification says that if request.getCharacterEncoding() is null then the client is using Latin-1 code page as charset.


Rahul Bhattacharjee
LinkedIn - Blog
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41798
    
  62
What happens if the client has already set Character Encoding header to some encoding other that utf-8 ?


The encoding would only be something else if the page sent to the browser before wasn't UTF-8, so I don't think this would be a problem.


Ping & DNS - my free Android networking tools app
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Ulf Dittmer:


The encoding would only be something else if the page sent to the browser before wasn't UTF-8, so I don't think this would be a problem.


Is this correct to say that if the server sends a resposne with UTF-8 then then the successive requests from the client would also use UTF-8 as character set.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41798
    
  62
Is this correct to say that if the server sends a resposne with UTF-8 then then the successive requests from the client would also use UTF-8 as character set.


Not successive requests in general, but requests (links and/or forms) activated from that particular web page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unicode Arabic to \uXXXX