Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unicode to Arabic

 
Prasanna Kumar Manohar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a searcher in my form , on click of searcher, it displays a popup window with a list of cities in arabic language. the functionality is when i click on any of the city in the list the value should be populated in the text field in the parent window and the pop up window should get closed. I am using window.returnValue for returning the chosen value

Issue : the value returned to the parent window from the pop up window has been changed to unicode . its like
"%U0672%U0679%U0674". its not populating the arabic literal.

Kindly let me know either how to convert this unicode in to arabic or let me know how to return the value in arabic instead of unicode from the pop up window to parent window

Thanks in advance.

Prasanna.
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasanna Kumar Manohar,

encode that value with encodeuri function in java script,Also in debugger see the which value you are getting if you getting value in arabic in debugger then it should work .
Take necessary steps to set the encoding to UTF-8 in jsp as well.

Regards
Jatan
 
Bhaskar boddupalli
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

you need to follow two steps to display the arabic text in your page

1. your JSP should holds characterset (<%@ page contentType="text/html; charset=windows-1256" autoFlush="true"%>)
2. you need to encode the value in the before display (String encoded=new String (toEncode.getBytes("ISO-8859-1"),"windows-1256"))

It should work.


Thanks
Bhaskar B
 
Prasanna Kumar Manohar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Thanks for all your replies. :)
got the solution, the below code works for me.

var cityAr = document.forms[0].citySearch.value;
var city_ar = cityAr.replace(/%/g,'\\');
eval("document.forms[0].citySearch.value=\""+city_ar+"\"");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic