{"id":426392,"date":"2021-04-06T00:11:44","date_gmt":"2021-04-05T16:11:44","guid":{"rendered":"http:\/\/4563.org\/?p=426392"},"modified":"2021-04-06T00:11:44","modified_gmt":"2021-04-05T16:11:44","slug":"java-%e5%ad%97%e7%ac%a6%e9%9b%86%e8%bd%ac%e6%8d%a2%e9%97%ae%e9%a2%98%ef%bc%8c%e6%b1%82%e5%8a%a9","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=426392","title":{"rendered":"Java \u5b57\u7b26\u96c6\u8f6c\u6362\u95ee\u9898\uff0c\u6c42\u52a9"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Java \u5b57\u7b26\u96c6\u8f6c\u6362\u95ee\u9898\uff0c\u6c42\u52a9               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wenlongde <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u547d\u4ee4\u884c\uff1a<\/p>\n<p>curl &#8216;http:\/\/192.168.1.1:9040\/S041&#8217; | iconv -f gbk -t utf8<\/p>\n<p>\u53ef\u4ee5\u5f97\u5230\u6b63\u5e38\u7684\u7ed3\u679c\uff0c\u7b26\u5408\u9884\u671f<\/p>\n<p>java \u4ee3\u7801\uff1a new String(retStr.getBytes(Charset.forName(&#8220;GBK&#8221;)), Charset.forName(&#8220;UTF-8&#8221;)); \u5f97\u5230\u7684\u662f\u4e71\u7801\uff0c\u4ec0\u4e48\u539f\u56e0\u5462?<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5722712\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : wenlongde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u63a5\u53e3\u8fd4\u56de\u7684\u662f\u542b\u6709\u4e2d\u6587\u5b57\u7b26\u7684 GBK \u7f16\u7801\u7684\u62a5\u6587                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5722713\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ychost <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u5199\u9519\u4e86\uff0cGBK -&gt; UTF8 \u8fd9\u6837\u5199 <\/p>\n<p>new String(str.getBytes(&#8220;UTF-8&#8243;),&#8221;UTF-8&#8221;);<\/p>\n<p>\u6ce8\uff1a\u53ea\u9700\u8981\u5199\u76ee\u6807\u7f16\u7801\uff0c\u539f\u59cb\u7f16\u7801\u53ef\u5ffd\u7565<br \/>\u53ef\u4ee5\u53c2\u8003\uff1a https:\/\/github.com\/jinpang\/Android\/blob\/master\/Java%20%E6%AD%A3%E7%A1%AE%E7%9A%84%E5%81%9A%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%BC%96%E7%A0%81%E8%BD%AC%E6%8D%A2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5722714\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iamlbk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             `new String(retStr.getBytes(Charset.forName(&#8220;GBK&#8221;)), Charset.forName(&#8220;UTF-8&#8221;));`<br \/>retStr \u5e94\u8be5\u5df2\u7ecf\u6709\u95ee\u9898\u4e86, \u5728\u63a5\u6536\u7ed3\u679c\u7684\u5730\u65b9\u5904\u7406\u7f16\u7801\u95ee\u9898<\/p>\n<p>\u8fd8\u6709\u4e00\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5c1d\u8bd5\u4e0b(UTF-8 \u662f\u63a5\u6536\u7f16\u7801):<br \/>`new String(retStr.getBytes(Charset.forName(&#8220;UTF-8&#8221;)), Charset.forName(&#8220;GBK&#8221;));`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5722715\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cheng6563 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Java \u7684 String \u5185\u90e8\u7f16\u7801\u662f UTF-16 \u3002<br \/>HTTP \u6570\u636e\u63a5\u6536\u8f6c\u5b57\u7b26\u4e32\u7684\u65f6\u5019\u4f1a\u8fdb\u884c\u4e00\u6b21\u8f6c\u7801\uff0c\u9ed8\u8ba4\u7531 -\u200bDfile.encoding \u6307\u5b9a\u7684\u7f16\u7801\u8f6c\uff0c\u6ca1\u6709\u6307\u5b9a -\u200bDfile.encoding \u5c31\u4f1a\u9884\u5b9a\u4e49\u4e00\u4e2a\u7f16\u7801\uff0cWindows \u7cfb\u7edf\u4e00\u822c\u4e3a GBK \u3002<br \/>\u8fd9\u65f6\u5982\u679c\u7528\u9519\u7f16\u7801\u5c31\u53ef\u80fd\u4f1a\u9020\u6210\u6570\u636e\u4e22\u5931\u5f97\u5230\u4e00\u4e2a\u4e0d\u5b8c\u6574\u7684 String\uff0c\u8fd9\u65f6\u518d\u8f6c\u6362\u7f16\u7801\u4e5f\u6ca1\u7528\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5722716\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dallaslu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b57\u7b26\u4e71\u7801\u8bf4\u660e<\/p>\n<p>https:\/\/twitter.com\/Linmiv\/status\/1336573220665737216                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Java \u5b57\u7b26\u96c6\u8f6c\u6362\u95ee\u9898\uff0c\u6c42\u52a9 \u8cc7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/426392"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=426392"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/426392\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=426392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=426392"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=426392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}