浣??闆緩涓?涓?JSP椤甸?㈢??璇?锛?灏變????伴?璁ょ???涓衡??ISO-8859-1??, ISO-8859-1?跺???瀛?绗???SCII?跺???瀛?绗??锛?杩?????瑗挎?ц??瑷???甯???璇???娉拌?????挎??浼?璇???甯?浼??ヨ??瀵瑰?????瀛?绗??楓??娆у??绗??峰?虹?扮??姣?杈???锛?娌℃??琚??跺???SO-8859-1褰?涓???姹?瀛?褰??舵病??浜?锛?姹?瀛???瀛?绗???涓?BK锛???绻?浣?锛???GB2312锛?涓???绠?浣?锛?锛?GBK缂????????煎??B2312????浠?SP椤甸???????涓?????¤???ワ??烘??灏變?浼??劇ず涔辯??锛?
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@page contentType="text/html;charset=gb2312"%>
<%request.setCharacterEncoding("gb2312");%>
?
浣???杩???YSQl??锛?浼?浜х??涔辯??锛?MySQL?版??搴?榛?璁ょ?????Latin1锛?Latin1??ISO-8859-1??????锛???浜???澧?涓???浣?Latin-1锛?瀹?瑁?mysql?版??搴??訛?浣???浠ラ???╃????煎?涓?BK????GB2312,濡???浣?娌℃敞???闆凡缁?瀹?瑁??跺??涔?涓??捐В?籌?
?
1锛???????? 濡???浣???SP椤甸?㈡??浣??蟲??姹?瀛?????瀹規???ュ??YSQL?版??搴?涓??訛?????灏?缂????煎?杞???涓?涓?灏辮?锛??蜂???浣?濡?涓?锛?
<%
String example=??杩???瑕?????YSQL涓???姹?瀛???;
example=new String(example.getBytes(??GB2312??),?? Latin1??);
%>
?
2锛???????? 灏?MYSQL涓???姹?瀛????烘?ユ?劇ず??SP椤甸???涔?灏辨??涓??㈢??????浣?锛?
<%
example=new String(example.getBytes(??Latin1??),??GB2312??);
%>
?
?諱?涓??ヨ??灏辨??灏?Latin1??GB2312涔??磋?琛?杞???灏卞?浜?锛?
?
?