1. <% response. setcontenttype ("text/vnd. WAP. WML; charset = UTF-8"; %> // utf8
2. <% request. setcharacterencoding ("UTF-8"; %> // parameter processing method utf8
3. <% @ page pageencoding = "ISO-8859-1" %> // page Character Handling Method iso-8859-1
My JSP Example:
Input page test1.jsp:
1. <% @ page contenttype = "text/vnd. WAP. WML; charset = gb2312" %>
2. <% @ page pageencoding = "ISO-8859-1" %>
3. <? XML version = "1.0"?>
4. <! Doctype WML public "-// wapforum // dtd wml 1.1 // en ""Http://www.wapforum.org/DTD/wml_1.1.xml">
5. <WML>
6. <card id = "test1" Title = "Chinese Character Input">
7. <p>
8. Name <input name = "name" size = "10"/> <br/>
9. Number <input name = "ID" format = "* n" size = "12"/> <br/>
10.
11. <anchor> OK
12. <go href = "test2.jsp" method = "Post">
13. <postfield name = "name" value = "name"/>
14. <postfield name = "ID" value = "ID"/>
15.
16. </go>
17. </anchor>
18. </card>
19. </WML>
// The above uses the go method = "Post"> method to transmit parameters. It does not seem to work with get.
Receiving page test2.jsp:
1. <% @ page contenttype = "text/vnd. WAP. WML; charset = UTF-8" %>
2. <? XML version = "1.0"?>
3. <! Doctype WML public "-// wapforum // dtd wml 1.1 // en ""Http://www.wapforum.org/DTD/wml_1.1.xml">
4. <WML>
5. <card id = "Test2" Title = "Chinese Character receiving">
6. <%
7. Request. setcharacterencoding ("UTF-8 ";
8. string name = request. getparameter ("name ";
9. String id = request. getparameter ("ID ";
10. %>
11. <p> name: <% = Name %> </P>
12. <p> ID: <% = ID %> </P>
13.
14. <do type = "Prev" label = "back to previous page">
15. <Prev/>
16. </DO>
17.
18. </card>
19. </WML>
Save the two files as UTF-8 files.
My main feeling is
Request. setcharacterencoding ("UTF-8 ″;
If the input page is in gb2312 format
To accept the page, use
Request. setcharacterencoding ("gb2312 ″;
We recommend that you use UTF-8 because the mobile gateway uses UTF-8.