1 | <metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/> |
1 2 | <%@ page language= "java" contentType = "text/html; charset=UTF-8" pageEncoding ="UTF-8" %> |
1 2 3 4 | publicvoid service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ response.setContentType("text/html;charset=utf-8"); } |
1 2 3 4 5 6 7 8 9 10 | <filter> <filter-name> Set Character Encoding</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name> encoding</param-name> <param-value> UTF-8</param-value> </init-param> </filter> |
1 2 3 | <Connectorport="80"protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"URIEncoding="utf-8"/> |
1 | <javacdebuglevel= "source,lines"source= "1.6"encoding= "utf-8"> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | < artifactId> maven-compiler-plugin </artifactId> < version> 2.5 </version> < configuration> < optimize> true </optimize> < showDeprecation> false </showDeprecation> < debuglevel> lines,source </debuglevel> < source> 1.6 </source> < target> 1.6 </target> < encoding> UTF-8 </encoding> < meminitial> 128m </meminitial> < maxmem> 768m </maxmem> </ configuration> |
1 | <!--?xml version="1.0" encoding="UTF-8"?--> |
1 2 3 4 5 | [mysqld] default-character-set = utf8 [ mysql] character_set_server = utf8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | publicstaticString Utf2String (byte buf[]){ int len = buf.length; StringBuffer sb =newStringBuffer(len /2); for(int i =0; i < len; i++){ if(by2int(buf[i])<= 0x7F) sb.append((char) buf[i]); elseif(by2int(buf[i])<= 0xDF && by2int(buf[i])>= 0xC0){ int bh = by2int(buf[i]& 0x1F); int bl = by2int(buf[++i]& 0x3F); bl = by2int(bh <<6| bl); bh = by2int(bh >>2); int c = bh <<8| bl; sb.append((char) c); }elseif(by2int(buf[i])<= 0xEF && by2int(buf[i])>= 0xE0){ int bh = by2int(buf[i]& 0x0F); int bl = by2int(buf[++i]& 0x3F); int bll = by2int(buf[++i]& 0x3F); bh = by2int(bh <<4| bl >>2); bl = by2int(bl <<6| bll); int c = bh <<8| bl; // 空格轉換爲半角 if(c ==58865){ c =32; } sb.append((char) c); } } return sb.toString(); } |
1 2 3 4 5 | [mysqld] default-character-set =utf8mb4 [ mysql] character_set_server = utf8mb4 |
1 2 3 | LANG="zh_CN.GB3212" LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN" SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en" |
1 2 | export LC_ALL="zh_CN.GB2312" export LANG="zh_CN.GB2312" |