strvalue=new String(strvalue.getBytes("ISO8859_1","GBK"));肯定正确,快给分吧

解决方案 »

  1.   

    楼上语法都不对哦:p
    strvalue=new String(strvalue.getBytes("ISO8859_1"),"GBK");
    strvalue=new String(strvalue.getBytes(),"GBK");
    都试试
      

  2.   

    还有别忘了再你的页面前面加
    <%@ page contentType="text/html; charset=gb2312" %>
      

  3.   

    strvalue = new String(strvalue.getBytes("ISO8859_1"));
    足够了!
      

  4.   

    如果你的字段数据类型为CHAR,那就不用试了,
    以上方法没一个可行!
      

  5.   

    oracle的jdbc driver中有对字符集转换的支持,转码文件是nls_charset12.zip,用法你可以查一下文档,http://download-west.oracle.com/docs/cd/A87862_01/NT817CLI/java.817/a83724.pdf
      

  6.   

    import java.io.*;public class L18NString {  private static final String  inCode = "ISO-8859-1";
      private static final String  outCode  = "gb2312";
      private L18NString() {
      }
      public static String readString(String inputString){
        try {
          byte[] tempByte = inputString.getBytes(inCode);
          inputString = new String(tempByte,outCode);
        }
        catch (UnsupportedEncodingException ex) {
          throw new RuntimeException("Unsupported encoding type.");
        }finally{
          return inputString;
        }
      }
      public static String writeString(String inputString){
        try {
          byte[] tempByte = inputString.getBytes(outCode);
          inputString = new String(tempByte,inCode);
        }
        catch (UnsupportedEncodingException ex) {
          throw new RuntimeException("Unsupported encoding type.");
        }finally{
          return inputString;
        }
      }  public static void main(String[] args){
      }
    }显示的时候用readString(String inputString),寸到数据库时用writeString(String inputString),就行了。我刚试过的。