Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unicode Arabic to \uXXXX

 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java supports Unicode. Oracle supports Unicode. Why would you need to use the Unicode value at all?
 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meaning...I can directly do the transferring in and out ?
 
Paul Clapham
Sheriff
Posts: 21149
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic