I'll start with the easy questions:
I'm testing with the JSWDK-1.0.1, with the built-in web server.
I set the character set in the JSP using the contentType="test/html;
charset=EUC_CN" directive. (or MS936, and a couple of others I can't
remember)
Here are the relevant parts of the JSP:
<%@ page import="domino.HeadlinePrinter3" contentType="text/html;
charset=EUC_CN" %>
<jsp:useBean id="test" class="domino.HeadlinePrinter3" />
<html><!-- #BeginTemplate "/Templates/VerticalC.dwt" -->
<head>
<!-- #BeginEditable "doctitle" -->
<title>Untitled Document</title>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=EUC_CN"> [also
tried with gb2312 and MS936, and with nothing]
<%
String output = test.printHeadline();
out.print(output);
%>
Here are excerpts of the printHeadline() method:
headline = doc.getItemValueString( "ChnHeadline" );
content.append( "<span class='headlines'>" + headline + "</span><br>"
+ doc.getItemValueString( "ChnSummary" ) + "<br>" );
doc = view.getNextDocument(doc);
}
}
content.append( "</p>" );
/*
totalHeadline = content.toString();
printout = new String( (totalHeadline.getBytes()), "EUC_CN" );
}
catch ( UnsupportedEncodingException ue ) { ue.printStackTrace();
}
*/
}
catch (Exception e) {e.printStackTrace();}
finally {NotesThread.stermThread(); }
//return printout;
return content.toString();
}
}
As you can see, I tried two ways of getting the String back = either
directly as a string (via a StringBuffer) or converted into a byte array
and then reencoded.
As for the "garbage", it is mostly question marks. I have been trying to
copy a sample into this mail, but it keeps crashing Notes.
The translated files look fine to me - the coding is really very simple,
and I think this is just an encoding problem, but where?
"Scott
Stirling" To: <[EMAIL PROTECTED]>
<sstirling@med cc:
iaone.net> Subject: Re: JSP, beans, Notes & Chinese
2000.03.23
12:05
Contact:
Company:
Too vague. What do you mean "garbage?" Garbage to you might mean
something
to me. What do the translated Java files look like? Can you post a simple
test JSP that reproduces the problem? What technique are you using to set
the charset in the JSPs? What verison of JSP? What JSP container?
Scott Stirling
----- Original Message -----
From: "John Prince" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 22, 2000 6:38 PM
Subject: JSP, beans, Notes & Chinese
> I'm trying to build a JSP/bean setup which gets simplified Chinese (GB )
> from a Notes database. Here is the setup:
>
> English Notes running on English NT server
> web page encoding gb2312
> Direct access to database through the Notes Java API.
>
> The problem is that it returns garbage. I have tried playing around with
> the encoding on the jsp page (using EUC_CN and others), and in the bean.
> Weirdly, I can get Chinese out of the database, but then the rest of the
> surrounding Chinese on the page is garbage. Or I can get the rest of the
> page fine, and the Notes stuff is garbage.
>
> I have even tried converting the database strings to a byte array and
then
> re-encoding them with String (byte[ ], String enc) but this doesn't seem
to
> work either.
>
> Any ideas?
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets