• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JBoss character encoding problems...

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello you all,
I'm developing a project that makes extensive use of CMP Entity EJBs deployed on a JBoss server. The Entity EJBs are mapped against a MySQL server with support for international character encoding; I�m sure of this because I can make SQL queries against the database using search fields that contain tildes and it works fine.
Moreover, when I obtain an Entity EJB by using its home interface and do a "String getWhatever()", if the field contains tildes they are correctly returned.
The problem arises when I try to make a search using the automatically generated finders (using ejb-ql). If I try to search for sth that contains tildes, it doesn't return anything (don't find it). But the same search for sth without tildes works fine.
So I suppose the problem is with the ejb-ql automatically generated finders, that for some reason don't cope with the tildes... Is there a way to specify what character encoding set should they use or sth like that?
I've searching through the older postings but haven't found anything that could help me. I must admit that I am really lost with this thing...
Any help will be really appreciated.
Thanks in advance.
 
Juantxo Bilbao
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I've found the solution by myself
In case anyone runs into a problem like this, there goes the solution:
ejb-ql, by default, uses Unicode as its standard string format, so there's no problem in passing or returning Unicode formatted strings, as I first thought.
The problem was in what I was **passing** as a parameter to the finder: I was calling the .findByServiceName(String) from a Struts action that, surprisingly, didn't return me the html "post" parameters as Unicode (even though I had specified that the originating page had Content-Type="UTF-8").
So the solution was easy: prior to getting the "post" parameters, just the following call was needed:
request.setCharacterEncoding("UTF-8");
And now it works perfect
Thanks anyway for reading the post. See you !
 
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch Juantxo! Glad you got your problem solved this time, and hope we see you 'round the ranch often.

Pauline
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic