• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

nepali unicodes issues different values in java passed from form and static value in java

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to send nepali sms and i am facing issue when we get value from form field

Message example  "मेरो नाम सागर हो"

when i pass through jsp page and sysout in java its string value is "मà¥Âरॠनाम साà¤Âर हà¥Â" and when sending this value through sms API we are getting same garble text instead of "मेरो नाम सागर हो"

But when I set static string message value example message="मेरो नाम सागर हो" and sysout value is "मà¥à¤°à¥ नाम साà¤à¤° हà¥" and when sending this value through sms API we are getting correct sms with मेरो नाम सागर हो msg

So I stuck with this dynamic content get through form field any sort of help means alot.
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like the text is not properly encoded somewhere along the way. Without seeing the relevant parts of the code, there isn't much we can advise.

sysout


Where or what is that? If it's a console of some kind, make sure it can display Unicode characters (most consoles can't). If it's a text file, make sure to open it in an app that can handle Unicode.
 
prajapatisagar Sagar
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:Sounds like the text is not properly encoded somewhere along the way. Without seeing the relevant parts of the code, there isn't much we can advise.

sysout


Where or what is that? If it's a console of some kind, make sure it can display Unicode characters (most consoles can't). If it's a text file, make sure to open it in an app that can handle Unicode.



I am doing System.out.println() in eclipse IDE and running the sample program as java application. Also checked the JVM supports UTF-8 Characters.
 
Sheriff
Posts: 28411
102
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

prajapatisagar Sagar wrote:I am doing System.out.println() in eclipse IDE



Like Tim said, don't do that. You don't know what encoding it's using or even whether it's writing to a console which supports Unicode. If you want to test data in your code, write it to a file using a Writer with UTF-8 as encoding, and then use an editor which supports both UTF-8 and a Nepali font to look at that file.

But your JSP: it's clear that as the data goes from the client machine to your server it's being corrupted. That's probably because you didn't force that communication to be in UTF-8. (The servlet spec defaults to ISO-8859-1 for that encoding, which was a blunder by the people who wrote the spec but now we're stuck with that.)

Actually in your case it's better to just send an SMS to test the data, since that appears to work correctly for correctly-encoded characters like your static variable.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic