You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by shanmugampl <sh...@india.adventnet.com> on 2002/07/11 07:04:48 UTC

Regarding charset

Hi,

    I am a Tomcat3.2 user. I have some problems with setting the charset 
in my pages. my scenario is as below.

Scenario 1:

1. I have a page A.jsp in which i have some chinese characters.
2. At the very start of A.jsp i have included page B.jsp using the 
include directive.
3. In B.jsp i have set the content type as gb2312 using the page directive.
4. After these changes i compiled the jsp file A.jsp(with encoding as 
UTF-8) using JSPC. In the source code, the chinese characters in my 
A.jsp was replaced as 
 out.write("\r\n<br>\r\n<br>\r\nChinese CHARACTERS: 
Ã~QÃ~EȢÃ~VÃ~P¹ú\r\n<script>\r\nalert(\"Ã~QÃ~EȢÃ~VÃ~P¹ú\");\r\n</script>\r\nrooting12\r\n<br>\r\nI18N 
");

Scenario 2:

1. I have a page A.jsp in which i have some chinese characters.
2. At the very start of A.jsp i have included page B.jsp using the 
include directive.
3. In A.jsp i have set the content type as gb2312 using the page directive.
4. After these changes i compiled the jsp file A.jsp (with encoding as 
UTF-8) using JSPC. In the source code, the chinese characters in my 
A.jsp was replaced as

 out.write("\r\n<br>\r\nCHINESE CHARACTERS: 
é~[~Eè~Y~N中å~[½\r\n<script>\r\nalert(\"é~[~Eè~Y~N中å~[½\");\r\n</script>\r\nrooting12\r\n<br>\r\nI18N 
");          


    Here it can be seen that the character formation is different in 
each case. My understanding is that if i set my content type in the 
included page then it should get reflected in the page that includes it. 
So i think that Scenerio 1 should result the same as Scenario2. Am i 
understanding it correctly or not. If not can any one say what is the 
mistake i am making.

Thanks
Shanmugam.PL


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Regarding charset

Posted by Irina Lishchenko <il...@lishchenko.de>.
I have reviewed one more time my application with encoding. Earlier when I 
was running apache with jserv (jserv runs with ojsp compiler) I had one 
include wich was common for all my jsp pages in my application and that was 
usually included somewhere in the beginning of my jsp pages. I was convinient 
because if I want for example to change one cyrrilic encoding to another one 
it is enough to change it one time in the included file, then touch *.jsp and 
changes appear everywhere in all jsp pages. 
But obviously it does not work the same in the apache & tomcat configuration. 
I was forced to put encoding dirrective as a first statement in all my 
primary jsp pages in order to make cyrrilic be shown properly.

On Thursday 11 July 2002 07:04, you wrote:
> Hi,
>
>     I am a Tomcat3.2 user. I have some problems with setting the charset
> in my pages. my scenario is as below.
>
> Scenario 1:
>
> 1. I have a page A.jsp in which i have some chinese characters.
> 2. At the very start of A.jsp i have included page B.jsp using the
> include directive.
> 3. In B.jsp i have set the content type as gb2312 using the page directive.
> 4. After these changes i compiled the jsp file A.jsp(with encoding as
> UTF-8) using JSPC. In the source code, the chinese characters in my
> A.jsp was replaced as
>  out.write("\r\n<br>\r\n<br>\r\nChinese CHARACTERS:
> Ã~QÃ~EȢÃ~VÃ~P¹ú\r\n<script>\r\nalert(\"Ã~QÃ~EȢÃ~VÃ~P¹ú\");\r\n</s
>cript>\r\nrooting12\r\n<br>\r\nI18N ");
>
> Scenario 2:
>
> 1. I have a page A.jsp in which i have some chinese characters.
> 2. At the very start of A.jsp i have included page B.jsp using the
> include directive.
> 3. In A.jsp i have set the content type as gb2312 using the page directive.
> 4. After these changes i compiled the jsp file A.jsp (with encoding as
> UTF-8) using JSPC. In the source code, the chinese characters in my
> A.jsp was replaced as
>
>  out.write("\r\n<br>\r\nCHINESE CHARACTERS:
> é~[~Eè~Y~N中å~[½\r\n<script>\r\nalert(\"é~[~Eè~Y~N中å~[½\");\r\n</script>
>\r\nrooting12\r\n<br>\r\nI18N ");
>
>
>     Here it can be seen that the character formation is different in
> each case. My understanding is that if i set my content type in the
> included page then it should get reflected in the page that includes it.
> So i think that Scenerio 1 should result the same as Scenario2. Am i
> understanding it correctly or not. If not can any one say what is the
> mistake i am making.
>
> Thanks
> Shanmugam.PL

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Regarding charset

Posted by Irina Lishchenko <il...@lishchenko.de>.
The problem is that I can not see real chinese characters in both your 
scenario even if I change the encoding of your message either to UTF8 or 
gb2312. But I assume (may be I have misunderstood you:/) that you can not get 
right encoding and right reflecting of your chinese characters. 

I had the same problem working with cyrrilic. In my configuration (tomcat 
3.2.3-43 running on SuSE Linux 7.3 with apache-1.3.20-29) the right encoding 
appears only if I use encoding directives as a first statement of A.jsp page, 
which also have lots of Include directives,  and if it is on the third or 
fourth (or n) position I can not see right cyrrilic characters in the 
resulted page

At the same time when I run application with apache & jserv module and the 
same page A.jsp with the encoding directive on a different from the first 
position the encoding works fine independently where encoding directives is


On Thursday 11 July 2002 07:04, you wrote:
> Hi,
>
>     I am a Tomcat3.2 user. I have some problems with setting the charset
> in my pages. my scenario is as below.
>
> Scenario 1:
>
> 1. I have a page A.jsp in which i have some chinese characters.
> 2. At the very start of A.jsp i have included page B.jsp using the
> include directive.
> 3. In B.jsp i have set the content type as gb2312 using the page directive.
> 4. After these changes i compiled the jsp file A.jsp(with encoding as
> UTF-8) using JSPC. In the source code, the chinese characters in my
> A.jsp was replaced as
>  out.write("\r\n<br>\r\n<br>\r\nChinese CHARACTERS:
> Ã~QÃ~EȢÃ~VÃ~P¹ú\r\n<script>\r\nalert(\"Ã~QÃ~EȢÃ~VÃ~P¹ú\");\r\n</s
>cript>\r\nrooting12\r\n<br>\r\nI18N ");
>
> Scenario 2:
>
> 1. I have a page A.jsp in which i have some chinese characters.
> 2. At the very start of A.jsp i have included page B.jsp using the
> include directive.
> 3. In A.jsp i have set the content type as gb2312 using the page directive.
> 4. After these changes i compiled the jsp file A.jsp (with encoding as
> UTF-8) using JSPC. In the source code, the chinese characters in my
> A.jsp was replaced as
>
>  out.write("\r\n<br>\r\nCHINESE CHARACTERS:
> é~[~Eè~Y~N中å~[½\r\n<script>\r\nalert(\"é~[~Eè~Y~N中å~[½\");\r\n</script>
>\r\nrooting12\r\n<br>\r\nI18N ");
>
>
>     Here it can be seen that the character formation is different in
> each case. My understanding is that if i set my content type in the
> included page then it should get reflected in the page that includes it.
> So i think that Scenerio 1 should result the same as Scenario2. Am i
> understanding it correctly or not. If not can any one say what is the
> mistake i am making.
>
> Thanks
> Shanmugam.PL

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>