Hi Taavi,

I have encountered a problem that sounds related to yours. I tried to make
japanese characters ailable on a page (although I don't expect japanese
input), and set

<META http-equiv=Content-Type content="text/html; charset=euc-jp">

before some unicode output - which I copied from a translation engine. All I
got was garbage (I have japanese support installed on that particular W2000
machine). Even after setting my editor to Unicode (I use EditPlus for much
of my work), copy/paste into my editor would fail  and not produce the
correct Unicode chars, and of course the jsp's output was garbage, too.

I got this to work only after copying a japanese page to my computer,
loading it into my editor, and voila - suddenly copy/paste worked correctly
and so does my output from my jsp's. Any new page I write I have to use an
exisitng working japanese page as a template in order for it to function
correctly.

I did *not* include the @page directive into my code - it works correctly
with just the <META ...> tag

        --peter

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Taavi Tiirik
Sent: Friday, April 13, 2001 8:23 AM
To: Orion-Interest
Subject: platform independent jsp code. how?

Hello,

I have still problems getting orion to work with unicode
characters. Here is a jsp page that behaves differently
on different platforms. Could you please help me to find
a way to make it platform independent.

I know that unicode is not something most of you should
pay attention to right now. Still, soon... :-)

My original problem was that without specifing correct
locale information, request.getParameter() returned
something else than expected. So, on solaris platform
I added environment variable LANG=en_US.UTF-8 before
running orion. Good, got it working.

Then, the very same code did not run under win2000. For
some reason specifying character set with a <% @page %>
directive on top of jsp page does not work with win2000.
Why?

So in the meantime the best way I have found around this
problem is to have
        <%@ page contentType="text/html; charset=utf-8" %>
on top of every jsp file on solaris platform and NOT
TO HAVE this line under win2000. Why? Is there something
wrong with this line? How should it be written under
win2000?

--- (start of 'utf-8test.jsp') -------------------
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>

<body>

<% String q = request.getParameter( "q" ); %>

query="<%= q %>"

<form>
<input type="text" name="q" value="<%= q %>">
<input type="submit">
</form>

example 1
<a href="utf-8test.jsp?q=asd">(asd)</a>
- no wonder this one is working<br>

example 2
<a href="utf-8test.jsp?q=%C3%B5%C3%A4%C3%B6%C3%BC%C5%A1%C5%BE"
>(&otilde;&auml;&ouml;&uuml;&#353;&#382;)</a>
- here I am having problems<br>

</body>
</html>
--- (end of 'utf-8test.jsp') ---------------------

On this page there is a text field. Place as complex
characters as you can think of into this field and submit
the form. You shuld see the very same text you entered
and not some garbage in your browser.

And I am speaking about 'solaris' and 'win2000' merely
because I really haven't tried this on other unix and nt
systems.

On both systems I am running jdk1.3 and orion 1.4.5.

Oh and one more thing. Tomcat 3.2.1 does not need
<%@ page contentType="text/html; charset=utf-8" %>
on top of a jsp page. In fact, it can not live with it.
It works without and even without specifying LANG
environment variable. So much about platform
idependency.

I really need to find a solution because I am using
win2000 on my development machine and deploying it
to solaris.

Any ideas?

thank you for your time,
Taavi




Reply via email to