国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

詭異的mysqllatin1編碼_MySQL

來源:懂視網 責編:小采 時間:2020-11-09 18:12:49
文檔

詭異的mysqllatin1編碼_MySQL

詭異的mysqllatin1編碼_MySQL:bitsCN.com Mysql 的latin1 不等于標準的latin1(iso-8859-1) 和cp1252,比iso-8859-1多了0x80-0x9f字符,比cp1252多了0x81,0x8d,0x8f,0x90,0x9d 一共5個字符。http://dev.mysql.com/doc/refman/5.0/en/charse
推薦度:
導讀詭異的mysqllatin1編碼_MySQL:bitsCN.com Mysql 的latin1 不等于標準的latin1(iso-8859-1) 和cp1252,比iso-8859-1多了0x80-0x9f字符,比cp1252多了0x81,0x8d,0x8f,0x90,0x9d 一共5個字符。http://dev.mysql.com/doc/refman/5.0/en/charse

bitsCN.com

Mysql 的latin1 不等于標準的latin1(iso-8859-1) 和cp1252,比iso-8859-1多了0x80-0x9f字符,比cp1252多了0x81,0x8d,0x8f,0x90,0x9d 一共5個字符。

http://dev.mysql.com/doc/refman/5.0/en/charset-we-sets.html

latin1 is the default character set. MySQL's latin1 is the same as the Windows cp1252 character set. This means it is the same as the official ISO 8859-1 or IANA (Internet Assigned Numbers Authority) latin1, except that IANA latin1 treats the code points between 0x80 and 0x9f as “undefined,” whereas cp1252, and therefore MySQL's latin1, assign characters for those positions. For example, 0x80 is the Euro sign. For the “undefined” entries in cp1252, MySQL translates 0x81 to Unicode 0x0081, 0x8d to 0x008d, 0x8f to 0x008f, 0x90 to 0x0090, and 0x9d to 0x009d.

這樣在Java中,如果使用標準的iso-8859-1或者cp1252解碼可能出現亂碼。
s.getBytes("iso-8859-1") 或者 s.getBytes("cp1252");

寫了一段代碼來解決這個問題
private String convertCharset(String s){
if(s!=null){
try {
int length = s.length();
byte[] buffer = new byte[length];
//0x81 to Unicode 0x0081, 0x8d to 0x008d, 0x8f to 0x008f, 0x90 to 0x0090, and 0x9d to 0x009d.
for(int i=0;i char c = s.charAt(i);
if(c==0x0081){
buffer[i]=(byte)0x81;
}
else if(c==0x008d){
buffer[i]=(byte)0x8d;
}
else if(c==0x008f){
buffer[i]=(byte)0x8f;
}
else if(c==0x0090){
buffer[i]=(byte)0x90;
}
else if(c==0x009d){
buffer[i]=(byte)0x9d;
}
else{
buffer[i] = Character.toString(c).getBytes("cp1252")[0];
}
}
String result = new String(buffer,"utf-8");
return result;
} catch (UnsupportedEncodingException e) {
logger.error("charset convert error", e);
}
}
return null;
}

摘自 小明思考


bitsCN.com

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

詭異的mysqllatin1編碼_MySQL

詭異的mysqllatin1編碼_MySQL:bitsCN.com Mysql 的latin1 不等于標準的latin1(iso-8859-1) 和cp1252,比iso-8859-1多了0x80-0x9f字符,比cp1252多了0x81,0x8d,0x8f,0x90,0x9d 一共5個字符。http://dev.mysql.com/doc/refman/5.0/en/charse
推薦度:
標簽: 編碼 my mysql
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 国产第一页在线播放 | 日韩在线欧美 | 国产一级做a爰片在线看 | 日本 黄 a | 亚洲欧美日韩中文v在线 | 国产精品123 | 欧美国产日韩在线 | 日韩国产综合 | 国产日韩欧美91 | 国产成人精品视频一区二区不卡 | 日韩欧美在线综合网高清 | 精品久久综合一区二区 | 中文 字幕 高清 在线 | 久久精品福利 | 国产在线高清不卡免费播放 | 欧美日韩高清 | 欧美第五页| 伊人网伊人影院 | 亚洲一区二区久久 | 久久精品亚洲一区二区 | 欧美国产视频 | 欧美韩日 | 天天操夜夜做 | 亚洲国产精品免费 | 欧美一区二区视频在线观看 | 成人毛片在线播放 | 国产精品一区二区av | 91在线精品亚洲一区二区 | 在线免费黄色网址 | 91精品国产色综合久久 | 国产精品一区在线播放 | 国内精品一区二区在线观看 | 天堂va欧美ⅴa亚洲va一国产 | 91精品一区二区 | 欧美日韩精品在线播放 | 精品一区二区三区三区 | 欧美在线免费观看视频 | 国产二区精品 | 欧美一区二区在线播放 | 日韩综合图区 | 国内偷拍第一页 |