Sathish David Kumar N
asked on
how to pass the japnesh char to URL
Hi ,
how to pass the japnesh char to URL in java script, i tried with escape, encode URI method but no use ? its in UTF-8 format
is there any other way ?
Please post your current code
ASKER
Please check the below code !!
var sName= document.appActRes.sName.value;
var userFNF= document.appActRes.userFNF.value;
var userLNF= document.appActRes.userLNF.value;
var conFNF= document.appActRes.conFNF.value;
var conLNF= document.appActRes.conLNF.value;
var url = "/xxx/xSearch.do?action=popupfetch&screenName=app&fetch="+type+"&sName="+sName+"&userFNF="+userFNF+"&userLNF="+userLNF+"&conFNF="+conFNF+"&conLNF="+conLNF;
newwindow=window.open(url,"name","height=500,width=550,scrollbars=yes" );
if (window.focus) {newwindow.focus();}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Same result no change !! :(
What exactly is the result?
Do you have a live link to have a look to your page ?
Please past the result of
alert(uri);
here
alert(uri);
here
That looks ok to me. Precisely what is the problem you have? Are you sure it's not more like it's not making the request you expect?
I think there's a link with this question : https://www.experts-exchange.com/questions/26871660/how-encode-a-url-in-java-script.html
ASKER
So this URL Parameter i will get the value in the java (request.getParameter()) its giv junk value....
ASKER
What does the below give on your struts host vm?
System.out.println(System.getProperty("file.encoding"));
Those browser screenshots could indicate one or more of the following:
a. You don't have UTF-8 encoding enabled
b. You don't have Japanese font support
Open http://www.columbia.edu/kermit/utf8.html in the same browser and go down to 139. Make sure the Japanese is displayed properly
a. You don't have UTF-8 encoding enabled
b. You don't have Japanese font support
Open http://www.columbia.edu/kermit/utf8.html in the same browser and go down to 139. Make sure the Japanese is displayed properly
ASKER
>>>>>>>System.out.println( System.get Property(" file.encod ing"));
s its says Cp1252 how its possible ?
i have char -encodeing fileter there i am setting UTF-8 ?
How to find out where its cahnge to Cp1252?
s its says Cp1252 how its possible ?
i have char -encodeing fileter there i am setting UTF-8 ?
How to find out where its cahnge to Cp1252?
OK. That's not necessarily a deal breaker. If you've got a filter set up, you're probably OK. It just indicates that your platform is not natively Unicode. What was the result of my last comment?
ASKER
s its display properly .
Please also post (pref as attachment) the source code of that page you pictured
ASKER
which one ?
popup or parent ?
popup or parent ?
Both would be good
ASKER
Parent window
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="/x/ddtabmenufiles/ddcolortabs.css" />
<link rel="stylesheet" type="text/css" href="/x/css/x.css" />
<script type="text/javascript" src="/x/ddtabmenufiles/ddtabmenu.js"></script>
<script type="text/javascript" src="/x/js/x.js"></script>
<script language="javascript" charset="UTF-8" src="./js/approveAct.js" > </script>
<script language="javascript" src="./js/datetimepicker.js"> </script>
ASKER
do you need full JSP ?
Yes, that would be best. Attach as text file please
ASKER
x.txt parent
ASKER
CHild
x.txt
x.txt
Take a close look at the filter - it might not be getting called (put some debug in it)
ASKER
do u want that filter code ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
how to ensure that ?
container is configer with UTF-8 format ?
container is configer with UTF-8 format ?
what container r u using?
ASKER
Servlet 2.4
are you using tomcat?
ASKER
S tomcat only .
i set that value in server.xml also
i set that value in server.xml also
post your server.xml and I'll check it
ASKER
ASKER
URIEncoding="UTF-8" i set like this in port 8080
then where do you get the parameter value from the request?
ASKER
In my action (java) class .only
can you post that code.
and where you then pass the value to the page for rendering
and where you then pass the value to the page for rendering
ASKER
http://35082133#
in tha command i metion that i am passing the value to action class .
in my action normal request.getParmater() only i used ?
in tha command i metion that i am passing the value to action class .
in my action normal request.getParmater() only i used ?
ASKER
My filter class
private String encoding;
public void init(FilterConfig config) throws ServletException
{
encoding = config.getInitParameter("requestEncoding");
if( encoding==null ) encoding="UTF-8";
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain next)
throws IOException, ServletException
{
if(null == request.getCharacterEncoding())
request.setCharacterEncoding(encoding);
response.setContentType("text/html; charset=UTF-8");
response.setCharacterEncoding("UTF-8");
next.doFilter(request, response);
}
public void destroy(){}
> http://35082133#
wheres the value coming from in that code.
best to check that it is valid there before you pass it in the request
> in my action normal request.getParmater() only i used ?
then what do you do with it? how is it passed to the view?
> My filter class
the filter is not really related to your problem
wheres the value coming from in that code.
best to check that it is valid there before you pass it in the request
> in my action normal request.getParmater() only i used ?
then what do you do with it? how is it passed to the view?
> My filter class
the filter is not really related to your problem
ASKER
>>>>>>>then what do you do with it? how is it passed to the view?
getting values and pass to query and get some values .
set (setAttribute) both the values (getting from screen value & query result)
>>> wheres the value coming from in that code.
Its from DB .
>>>>>>best to check that it is valid there before you pass it in the request
How to check that ? I used check like this
System.out.println(System. getPropert y("file.en coding"));
s its says Cp1252 how its possible
getting values and pass to query and get some values .
set (setAttribute) both the values (getting from screen value & query result)
>>> wheres the value coming from in that code.
Its from DB .
>>>>>>best to check that it is valid there before you pass it in the request
How to check that ? I used check like this
System.out.println(System.
s its says Cp1252 how its possible
is the data in the database ok?
are you using utf8 for the database connection?
> How to check that ? I used check like this
try displaying the attribute directly on the page that is building the url and making the request
> System.out.println(System. getPropert y("file.en coding"));
That doesn't really make a difference in your case
are you using utf8 for the database connection?
> How to check that ? I used check like this
try displaying the attribute directly on the page that is building the url and making the request
> System.out.println(System.
That doesn't really make a difference in your case
ASKER
>>>>>>are you using utf8 for the database connection?
you mean db connection class ? its also java calss so request coming from filter only right ?
If i am worng how can i set that ??
you mean db connection class ? its also java calss so request coming from filter only right ?
If i am worng how can i set that ??
generally you set it in the connection string, depends on the db and driver
add some logging to output the value in various steps in the process so you can determine at which point it becomes corrupt
add some logging to output the value in various steps in the process so you can determine at which point it becomes corrupt
I thought it was info from the form that was corrupt, not db stuff dravidnsr?
ASKER
>>>> add some logging to output the value in various steps in the process so you can determine at which point it becomes corrupt
While coming from Jsp page only the format is changed.
>>>>>> I thought it was info from the form that was corrupt, not db stuff dravidnsr?
K how can i correct that ?
While coming from Jsp page only the format is changed.
>>>>>> I thought it was info from the form that was corrupt, not db stuff dravidnsr?
K how can i correct that ?
>>>>>> I thought it was info from the form that was corrupt, not db stuff dravidnsr?
Well firstly i'm asking YOU a question there actually. Is that the case?
Well firstly i'm asking YOU a question there actually. Is that the case?
> K how can i correct that ?
there is no form is there. So nothing to correct there :)
there is no form is there. So nothing to correct there :)
ASKER
Any other input ??
I'm still waiting for you to answer my question...
ASKER
which one??
ASKER
>>>>>>>>>>>>>>> I thought it was info from the form that was corrupt, not db stuff dravidnsr?
How can i know that form corrupt or not ?
How can i know that form corrupt or not ?
ASKER
I didnt change anything its working fine in my pc . But i deployed the code in UAT envi . its again give junk value ? how thats posible ............
what form are you referring to?
Did you add the logging as I suggested above? That should show you where the text is getting corrupted
Did you add the logging as I suggested above? That should show you where the text is getting corrupted
> I didnt change anything its working fine in my pc . But i deployed the code in UAT envi . its again give junk value ? how thats posible ............
check if the default encoding on the two boxes is different
check if the default encoding on the two boxes is different
ASKER
>>>>>>>>>>>>what form are you referring to?
I referred both the suggestion because i need solution
.
>>>>>>check if the default encoding on the two boxes is different
Two boxs means ? i put the same log in( u suggest above ) and directly deployed in that code i didnt remove log . i see in the log file the text file corrupt in UAT but not Dev
I referred both the suggestion because i need solution
.
>>>>>>check if the default encoding on the two boxes is different
Two boxs means ? i put the same log in( u suggest above ) and directly deployed in that code i didnt remove log . i see in the log file the text file corrupt in UAT but not Dev
> I referred both the suggestion because i need solution
I meant what html form are you referring to in your earlier comment. Thats the first time you had mentioned you had a problem with a form. If you can show me the form you think is corrupting it then I can check it for you.
> Two boxs means ? i put the same log in( u suggest above ) and directly deployed in that code i didnt remove log . i see in the log file the text file corrupt in UAT but not Dev
sounds like a different default encoding so check the default encoding on the UAT box
If thats the case then to fix it you can either change the default encoding, or make sure your code explicitly specifies the encoding to use everywhere
Worth adding logging in various places in the logic flow so you can see at what point it becomes corrupt. eg. is it corrupt in the datase, is it corrupt after being read from the db, is it corrupt when rendered on the page ....
I meant what html form are you referring to in your earlier comment. Thats the first time you had mentioned you had a problem with a form. If you can show me the form you think is corrupting it then I can check it for you.
> Two boxs means ? i put the same log in( u suggest above ) and directly deployed in that code i didnt remove log . i see in the log file the text file corrupt in UAT but not Dev
sounds like a different default encoding so check the default encoding on the UAT box
If thats the case then to fix it you can either change the default encoding, or make sure your code explicitly specifies the encoding to use everywhere
Worth adding logging in various places in the logic flow so you can see at what point it becomes corrupt. eg. is it corrupt in the datase, is it corrupt after being read from the db, is it corrupt when rendered on the page ....
> Two boxs means ?
sorry, I meant the two computers Dev and UAT
sorry, I meant the two computers Dev and UAT
Please verify that you deployed the filter to UAT and that it's being called
ASKER
my ant bulider have encoding format as ISO is that effect the code ??
>>my ant bulider have encoding format as ISO is that effect the code ??
Certainly if your code actually contains Japanese chars, these will be unrepresentable in ISO, so, yes
Certainly if your code actually contains Japanese chars, these will be unrepresentable in ISO, so, yes
> my ant bulider have encoding format as ISO is that effect the code ??
where is it using ISO?
where is it using ISO?
ASKER
>>>>>>>>>
where is it using ISO?
In my build.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Deploy From Eclipse to Tomcat" basedir=".">
where is it using ISO?
In my build.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Deploy From Eclipse to Tomcat" basedir=".">
thats fine :)
ASKER
>>>>>>>>>
add some logging to output the value in various steps in the process so you can determine at which point it becomes corrupt
what kind of log i will put . before that i put System.out.println(System. getPropert y("file.en coding"));
put it say project encoding format !after i convert the hole project in to UTF-8 format still have facing problem !!
add some logging to output the value in various steps in the process so you can determine at which point it becomes corrupt
what kind of log i will put . before that i put System.out.println(System.
put it say project encoding format !after i convert the hole project in to UTF-8 format still have facing problem !!
ASKER
i paln to do in byte array for debugging
new String (resultSet.getString(1).ge tBytes()," UTF-8") if i use this that popup will coming like ?????? mark ??
How can i know which encoding format is coming from DB ?
new String (resultSet.getString(1).ge
How can i know which encoding format is coming from DB ?
What you should do is limit the possible input values to as few as possible - preferably one only. Is that possible?
ASKER
ya its only one not more than that !! (its search screen and fetch only one value )
Please show (in Unicode escaped format) what the value of the field should be, e.g.
\u20ac\u1159
\u20ac\u1159
ASKER
which one??
The one field you're using, which you just mentioned:
>>ya its only one not more than that !!
(use the same value all the time when you're testing)
>>ya its only one not more than that !!
(use the same value all the time when you're testing)
ASKER
its search screen result page i am using jstl and some java script coding to use the same screen for all .
all search pages are working fine . which one you need for unicode format??
all search pages are working fine . which one you need for unicode format??
ASKER
>>>>>>>>ya its only one not more than that !! (its search screen and fetch only one value )
it fetch only one column but that column have more than 0ne vaue
it fetch only one column but that column have more than 0ne vaue
ASKER
actually my problem is
with form submit i can get the correct values (Japanese values) so its set proper char-set format
but with out form submitting like pop up window open(i want to retrieve some values so iam going with that url for popup) so that time my char set is not working not set so it gives junk values?.
with form submit i can get the correct values (Japanese values) so its set proper char-set format
but with out form submitting like pop up window open(i want to retrieve some values so iam going with that url for popup) so that time my char set is not working not set so it gives junk values?.
> what kind of log i will put . before that i put System.out.println(System. getPropert y("file.en coding"));
log the string value that is getting corrupted.
> new String (resultSet.getString(1).ge tBytes()," UTF-8") if i use this that popup will coming like ?????? mark ??
theres no need to do that, just output the string directly
log the string value that is getting corrupted.
> new String (resultSet.getString(1).ge
theres no need to do that, just output the string directly
ASKER
>>>>>>>>> new String (resultSet.getString(1).ge tBytes()," UTF-8") if i use this that popup will coming like ?????? mark ??
>>theres no need to do that, just output the string directly
I put the log (resultSet.getString(1))here the junk value are coming but display in screen is perfect ?? is it log file problem ??
>>theres no need to do that, just output the string directly
I put the log (resultSet.getString(1))here the junk value are coming but display in screen is perfect ?? is it log file problem ??
depends how are you viewing the log, you need to ensure whatever you are viewing it with has support for displaying japanese text
ASKER
No it not supporting ? i checked !
ASKER
org.displaytag.filter.Resp onseOverri deFilter.i nit(Respon seOverride Filter.jav a:108) - Filter initialized. Response buffering is enabled
i got this before its going to char set filter what kind of error is this ??
i got this before its going to char set filter what kind of error is this ??
then use something else to view the log. assuming the log is a text file then you just need something that can view text files containing japanese.
> i got this before its going to char set filter what kind of error is this ??
don't believe that is an error
don't believe that is an error
ASKER
sorry i wrongly pasted !!
org.apache.axis.configurat ion.Engine Configurat ionFactory Servlet.ge tServerEng ineConfig( EngineConf igurationF actoryServ let.java:1 62) - Unable to find config file. Creating new servlet engine config file: /WEB-INF/server-config.wsd d
this is the error ?
org.apache.axis.configurat
this is the error ?
its failing to find a wsdd, doubt thats related to your current problem
ASKER
lastly i found out .....
>>>>>>I didnt change anything its working fine in my pc . But i deployed the code in UAT envi . its again give junk value ? how thats posible ............
I didnt change server.xml file in deployement envi !!
>>>>>>I didnt change anything its working fine in my pc . But i deployed the code in UAT envi . its again give junk value ? how thats posible ............
I didnt change server.xml file in deployement envi !!
from what you have posted the problem is not in server.xml
ASKER
Thanks again . Really i dont know how to tell you have spen lot of time with me .
:)
You guys ROCK!