Chinese garbled problem

zhaozj2021-02-16  47

/ * Encoding conversion, make sure there is no garbled * / package dbjavabe when writing the database.

public class CodingConvert {public CodingConvert () {//} public String toGb (String uniStr) {String gbStr = ""; if (uniStr == null) {uniStr = "";} try {byte [] tempByte = uniStr.getBytes ("ISO8859_1"); GBSTR = New String (Tempbyte, "GB2312");} Catch (Exception EX) {} Return GBSTR;} Public String Touni (String GBSTR) {String Unistr = ""; IF (GBSTR == NULL ) {GBSTR = "";} try {byte [] tempbyte = gbstr.getbytes ("gb2312"); unistr = new string (Tempbyte, "ISO8859_1");} catCH (Exception EX) {} Return Unistr;}}

转载请注明原文地址:https://www.9cbs.com/read-28334.html

New Post(0)