Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Unicode Arabic to \uXXXX

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Meaning...I can directly do the transferring in and out ?
 
Marshal
Posts: 27374
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
A feeble attempt to tell you about our stuff that makes us money
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic