{"id":307002,"date":"2024-05-20T20:24:35","date_gmt":"2024-05-20T12:24:35","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/307002.html"},"modified":"2024-05-20T20:24:55","modified_gmt":"2024-05-20T12:24:55","slug":"eclipse%e4%b8%ad%e5%a6%82%e4%bd%95%e6%89%b9%e9%87%8f%e6%8a%8agbk%e7%bc%96%e7%a0%81%e7%9a%84java%e4%bb%a3%e7%a0%81%e8%bd%ac%e6%8d%a2%e6%88%90utf-8-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/307002.html","title":{"rendered":"Eclipse\u4e2d\u5982\u4f55\u6279\u91cf\u628aGBK\u7f16\u7801\u7684java\u4ee3\u7801\u8f6c\u6362\u6210utf-8"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26223358\/c8c5bffd-e55d-49aa-8779-4260b557c082.webp\" alt=\"Eclipse\u4e2d\u5982\u4f55\u6279\u91cf\u628aGBK\u7f16\u7801\u7684java\u4ee3\u7801\u8f6c\u6362\u6210utf-8\" \/><\/p>\n<p><p>\u5728Eclipse\u4e2d\u6279\u91cf\u628aGBK\u7f16\u7801\u7684Java\u4ee3\u7801\u8f6c\u6362\u6210UTF-8\u7f16\u7801\u53ef\u4ee5\u901a\u8fc7\u51e0\u4e2a\u5173\u952e\u6b65\u9aa4\u5b9e\u73b0\uff0c<strong>\u5305\u542b\u8bbe\u7f6e\u5de5\u4f5c\u7a7a\u95f4\u7684\u9ed8\u8ba4\u5b57\u7b26\u96c6\u3001\u6279\u91cf\u8f6c\u6362\u5df2\u6709\u6587\u4ef6\u7684\u7f16\u7801\u3001\u4ee5\u53ca\u9a8c\u8bc1\u8f6c\u6362\u7ed3\u679c<\/strong>\u3002\u8fd9\u4e9b\u65b9\u6cd5\u80fd\u591f\u9ad8\u6548\u3001\u51c6\u786e\u5730\u5b8c\u6210\u7f16\u7801\u8f6c\u6362\u4efb\u52a1\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u5927\u91cf\u9700\u8981\u8f6c\u6362\u7f16\u7801\u7684\u6587\u4ef6\u65f6\u663e\u5f97\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><p><strong>\u8bbe\u7f6e\u5de5\u4f5c\u7a7a\u95f4\u7684\u9ed8\u8ba4\u5b57\u7b26\u96c6<\/strong> \u662f\u8f6c\u6362\u8fc7\u7a0b\u4e2d\u7684\u9996\u8981\u6b65\u9aa4\u3002Eclipse\u5141\u8bb8\u7528\u6237\u4e3a\u6574\u4e2a\u5de5\u4f5c\u7a7a\u95f4\u6216\u5355\u4e2a\u9879\u76ee\u8bbe\u7f6e\u9ed8\u8ba4\u7684\u6587\u672c\u6587\u4ef6\u5b57\u7b26\u7f16\u7801\u3002\u901a\u8fc7\u5c06\u5de5\u4f5c\u7a7a\u95f4\u7684\u9ed8\u8ba4\u7f16\u7801\u8bbe\u7f6e\u4e3aUTF-8\uff0c\u53ef\u4ee5\u786e\u4fdd\u6240\u6709\u65b0\u521b\u5efa\u7684\u6587\u4ef6\u90fd\u5c06\u81ea\u52a8\u91c7\u7528UTF-8\u7f16\u7801\uff0c\u8fd9\u4e3a\u7edf\u4e00\u9879\u76ee\u4e2d\u6587\u4ef6\u7684\u7f16\u7801\u5960\u5b9a\u4e86\u57fa\u7840\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u8bbe\u7f6e\u5de5\u4f5c\u7a7a\u95f4\u7684\u9ed8\u8ba4\u5b57\u7b26\u96c6<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6253\u5f00Eclipse\uff0c\u70b9\u51fb\u83dc\u5355\u680f\u7684<code>Window<\/code> -&gt; <code>Preferences<\/code>\u3002\u5728\u6253\u5f00\u7684\u9996\u9009\u9879\u5bf9\u8bdd\u6846\u4e2d\uff0c\u5bfc\u822a\u5230<code>General<\/code> -&gt; <code>Workspace<\/code>\u3002\u5728Workspace\u9875\u9762\u4e2d\uff0c\u4f60\u4f1a\u627e\u5230<code>Text file encoding<\/code>\u7684\u8bbe\u7f6e\u9879\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6b64\u9009\u9879\u53ef\u80fd\u8bbe\u7f6e\u4e3a<code>Default (inherited from system)<\/code>\uff0c\u8fd9\u610f\u5473\u7740Eclipse\u4f1a\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u9ed8\u8ba4\u5b57\u7b26\u7f16\u7801\u3002\u70b9\u51fb<code>Other<\/code>\u9009\u9879\uff0c\u4ece\u4e0b\u62c9\u83dc\u5355\u4e2d\u9009\u62e9<code>UTF-8<\/code>\uff0c\u7136\u540e\u70b9\u51fb<code>Apply<\/code>\u548c<code>OK<\/code>\u4ee5\u5e94\u7528\u66f4\u6539\u3002<\/p>\n<\/p>\n<p><p>\u5176\u6b21\uff0c\u5bf9\u4e8e\u5df2\u7ecf\u5b58\u5728\u7684\u9879\u76ee\uff0c\u540c\u6837\u9700\u8981\u5355\u72ec\u8c03\u6574\u6bcf\u4e2a\u9879\u76ee\u7684\u7f16\u7801\u8bbe\u7f6e\uff0c\u4ee5\u786e\u4fdd\u9879\u76ee\u7ea7\u522b\u7684\u6587\u4ef6\u7f16\u7801\u4e00\u81f4\u6027\u3002\u53f3\u952e\u70b9\u51fb\u9879\u76ee\u540d\u79f0\uff0c\u9009\u62e9<code>Properties<\/code> -&gt; <code>Resource<\/code>\uff0c\u7136\u540e\u548c\u5de5\u4f5c\u7a7a\u95f4\u8bbe\u7f6e\u7684\u6b65\u9aa4\u76f8\u540c\uff0c\u6539\u53d8<code>Text file encoding<\/code>\u7684\u8bbe\u7f6e\u4e3a<code>UTF-8<\/code>\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u6279\u91cf\u8f6c\u6362\u5df2\u6709\u6587\u4ef6\u7684\u7f16\u7801<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u90a3\u4e9b\u5df2\u7ecf\u5b58\u5728\u4e14\u7f16\u7801\u4e3aGBK\u7684Java\u6e90\u6587\u4ef6\uff0c\u9700\u8981\u8fdb\u884c\u624b\u52a8\u8f6c\u6362\u6765\u4fdd\u6301\u9879\u76ee\u6587\u4ef6\u7f16\u7801\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8f6c\u6362\u5355\u4e2a\u6587\u4ef6\u7684\u7f16\u7801<\/strong>\uff1a\u53f3\u952e\u70b9\u51fb\u9700\u8981\u8f6c\u6362\u7684\u6587\u4ef6\uff0c\u9009\u62e9<code>Properties<\/code> -&gt; <code>Resource<\/code>\uff0c\u5728<code>Text file encoding<\/code>\u533a\u57df\u4e2d\u9009\u4e2d<code>Other<\/code>\uff0c\u7136\u540e\u4ece\u4e0b\u62c9\u83dc\u5355\u4e2d\u9009\u62e9<code>UTF-8<\/code>\uff0c\u6700\u540e\u70b9\u51fb<code>Apply and Close<\/code>\u5b8c\u6210\u8f6c\u6362\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6279\u91cf\u8f6c\u6362\u6587\u4ef6\u7684\u7f16\u7801<\/strong>\uff1a\u53f3\u952e\u70b9\u51fb\u9879\u76ee\u6216\u5305\u542b\u9700\u8981\u8f6c\u6362\u6587\u4ef6\u7684\u6587\u4ef6\u5939\uff0c\u9009\u62e9<code>Properties<\/code> -&gt; <code>Resource<\/code>\uff0c\u540c\u6837\u8c03\u6574<code>Text file encoding<\/code>\u81f3<code>UTF-8<\/code>\u3002\u8fd9\u5c06\u5e94\u7528\u4e8e\u6240\u6709\u9009\u4e2d\u6587\u4ef6\u5939\u4e0b\u7684\u6587\u4ef6\uff0c\u5b9e\u73b0\u6279\u91cf\u8f6c\u6362\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u9a8c\u8bc1\u8f6c\u6362\u7ed3\u679c<\/h3>\n<\/p>\n<p><p>\u8f6c\u6362\u7f16\u7801\u540e\uff0c\u91cd\u8981\u7684\u4e00\u6b65\u662f\u9a8c\u8bc1\u8f6c\u6362\u7ed3\u679c\uff0c\u786e\u4fdd\u6587\u4ef6\u5185\u5bb9\u6ca1\u6709\u56e0\u7f16\u7801\u8f6c\u6362\u800c\u51fa\u73b0\u4e71\u7801\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u68c0\u67e5<\/strong>\uff1a\u53ef\u4ee5\u4f7f\u7528\u652f\u6301\u591a\u79cd\u7f16\u7801\u67e5\u770b\u7684\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982Notepad++\u6216Sublime Text\uff09\u6253\u5f00\u8f6c\u6362\u540e\u7684\u6587\u4ef6\uff0c\u786e\u8ba4\u6587\u4ef6\u5185\u5bb9\u663e\u793a\u6b63\u5e38\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Eclipse\u4e2d\u67e5\u770b<\/strong>\uff1a\u5728Eclipse\u4e2d\u6253\u5f00\u8f6c\u6362\u540e\u7684\u6587\u4ef6\uff0c\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e71\u7801\u3002\u5982\u679c\u5b58\u5728\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u6587\u4ef6\u5728\u8f6c\u6362\u8fc7\u7a0b\u4e2d\u672a\u80fd\u6b63\u786e\u5904\u7406\u67d0\u4e9b\u5b57\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u5e38\u89c1\u95ee\u9898\u5904\u7406<\/h3>\n<\/p>\n<p><p>\u5728\u8f6c\u6362\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u5982\u90e8\u5206\u5b57\u7b26\u8f6c\u6362\u540e\u51fa\u73b0\u4e71\u7801\uff0c\u8fd9\u901a\u5e38\u662f\u7531\u4e8e\u539f\u6587\u4ef6\u4e2d\u5b58\u5728\u975eGBK\u7f16\u7801\u7684\u5b57\u7b26\u3002\u8fd9\u65f6\uff0c\u9700\u8981\u624b\u52a8\u5b9a\u4f4d\u8fd9\u4e9b\u5b57\u7b26\u5e76\u505a\u9002\u5f53\u7684\u66ff\u6362\u3002\u53e6\u5916\uff0c\u9879\u76ee\u4e2d\u5982\u679c\u6d89\u53ca\u7b2c\u4e09\u65b9\u5e93\u6216\u6846\u67b6\uff0c\u8fd8\u9700\u8981\u786e\u8ba4\u8fd9\u4e9b\u7ec4\u4ef6\u662f\u5426\u652f\u6301UTF-8\u7f16\u7801\uff0c\u4ee5\u907f\u514d\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u6709\u6548\u5730\u6279\u91cf\u628aEclipse\u4e2d\u7684GBK\u7f16\u7801\u7684Java\u4ee3\u7801\u8f6c\u6362\u6210UTF-8\uff0c\u4ece\u800c\u63d0\u5347\u9879\u76ee\u7684\u517c\u5bb9\u6027\u548c\u56fd\u9645\u5316\u6c34\u5e73\u3002\u8fd9\u5bf9\u4e8e\u591a\u8bed\u8a00\u73af\u5883\u4e0b\u7684\u5f00\u53d1\u5c24\u4e3a\u91cd\u8981\uff0c\u80fd\u591f\u786e\u4fdd\u4ee3\u7801\u7684\u6b63\u5e38\u663e\u793a\u548c\u6267\u884c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>Q\uff1a\u5982\u4f55\u5728Eclipse\u4e2d\u5c06\u591a\u4e2a\u6587\u4ef6\u7684\u7f16\u7801\u4eceGBK\u8f6c\u6362\u4e3aUTF-8\uff1f<\/strong><\/p>\n<p>A\uff1a\u5728Eclipse\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\u5c06\u591a\u4e2a\u6587\u4ef6\u7684\u7f16\u7801\u4eceGBK\u8f6c\u6362\u4e3aUTF-8\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00Eclipse\u5e76\u5bfc\u822a\u5230\u60a8\u7684\u9879\u76ee\u6587\u4ef6\u5939\u3002<\/li>\n<li>\u5728\u9879\u76ee\u6587\u4ef6\u5939\u4e2d\uff0c\u9009\u62e9\u8981\u8f6c\u6362\u7f16\u7801\u7684\u6240\u6709java\u6587\u4ef6\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u9009\u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u9009\u62e9\u201cProperties\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u201cProperties\u201d\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u201cResource\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u201cText file encoding\u201d\u90e8\u5206\uff0c\u9009\u62e9\u201cOther\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u9009\u62e9\u201cUTF-8\u201d\u7f16\u7801\uff0c\u5e76\u70b9\u51fb\u201cOK\u201d\u6309\u94ae\u3002<\/li>\n<li>\u786e\u8ba4\u6240\u6709\u9009\u4e2d\u7684\u6587\u4ef6\u7684\u7f16\u7801\u90fd\u5df2\u66f4\u6539\u4e3aUTF-8\u3002<\/li>\n<\/ol>\n<p><strong>Q\uff1a\u6211\u600e\u6837\u624d\u80fd\u4e00\u6b21\u6027\u5c06Eclipse\u9879\u76ee\u4e2d\u7684\u6240\u6709java\u6587\u4ef6\u4eceGBK\u7f16\u7801\u8f6c\u6362\u4e3aUTF-8\uff1f<\/strong><\/p>\n<p>A\uff1a\u5982\u679c\u60a8\u60f3\u4e00\u6b21\u6027\u5c06\u6574\u4e2aEclipse\u9879\u76ee\u4e2d\u7684\u6240\u6709java\u6587\u4ef6\u4eceGBK\u7f16\u7801\u8f6c\u6362\u4e3aUTF-8\uff0c\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u5728Eclipse\u4e2d\uff0c\u5bfc\u822a\u5230\u9879\u76ee\u6587\u4ef6\u5939\u3002<\/li>\n<li>\u5728\u9879\u76ee\u6587\u4ef6\u5939\u4e2d\uff0c\u53f3\u952e\u5355\u51fb\u5e76\u9009\u62e9\u201cProperties\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u201cProperties\u201d\u7a97\u53e3\u4e2d\uff0c\u9009\u62e9\u201cResource\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u201cText file encoding\u201d\u90e8\u5206\uff0c\u9009\u62e9\u201cOther\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u9009\u62e9\u201cUTF-8\u201d\u7f16\u7801\uff0c\u5e76\u70b9\u51fb\u201cOK\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u786e\u8ba4\u5bf9\u8bdd\u6846\u4e2d\uff0c\u9009\u62e9\u201cApply\u201d\u6765\u5c06\u9879\u76ee\u4e2d\u6240\u6709\u6587\u4ef6\u7684\u7f16\u7801\u4eceGBK\u8f6c\u6362\u4e3aUTF-8\u3002<\/li>\n<\/ol>\n<p><strong>Q\uff1a\u6709\u6ca1\u6709\u4e00\u79cd\u5feb\u901f\u7684\u65b9\u6cd5\u53ef\u4ee5\u5c06Eclipse\u4e2d\u7684\u6240\u6709java\u6587\u4ef6\u4eceGBK\u7f16\u7801\u6279\u91cf\u8f6c\u6362\u4e3aUTF-8\uff1f<\/strong><\/p>\n<p>A\uff1a\u662f\u7684\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Eclipse\u7684\u4e00\u4e2a\u63d2\u4ef6\u6765\u5feb\u901f\u7684\u5c06\u6240\u6709java\u6587\u4ef6\u4eceGBK\u7f16\u7801\u6279\u91cf\u8f6c\u6362\u4e3aUTF-8\u3002\u4f60\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00Eclipse\u5e76\u5bfc\u822a\u5230\u201cHelp\u201d\u83dc\u5355\u3002<\/li>\n<li>\u5728\u201cHelp\u201d\u83dc\u5355\u4e2d\uff0c\u9009\u62e9\u201cEclipse Marketplace\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u201cEclipse Marketplace\u201d\u7a97\u53e3\u4e2d\uff0c\u641c\u7d22\u201cGBK to UTF-8 Conversion\u201d\u63d2\u4ef6\u3002<\/li>\n<li>\u627e\u5230\u5e76\u5b89\u88c5\u201cGBK to UTF-8 Conversion\u201d\u63d2\u4ef6\u3002<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5bfc\u822a\u5230\u9879\u76ee\u6587\u4ef6\u5939\uff0c\u53f3\u952e\u5355\u51fb\u5e76\u9009\u62e9\u201cGBK to UTF-8 Conversion\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u9009\u62e9\u201cConvert project recursively\u201d\u9009\u9879\u5e76\u70b9\u51fb\u201cOK\u201d\u6309\u94ae\u3002<\/li>\n<li>\u63d2\u4ef6\u5c06\u81ea\u52a8\u5c06\u9879\u76ee\u4e2d\u7684\u6240\u6709java\u6587\u4ef6\u4eceGBK\u7f16\u7801\u6279\u91cf\u8f6c\u6362\u4e3aUTF-8\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"\u5728Eclipse\u4e2d\u6279\u91cf\u628aGBK\u7f16\u7801\u7684Java\u4ee3\u7801\u8f6c\u6362\u6210UTF-8\u7f16\u7801\u53ef\u4ee5\u901a\u8fc7\u51e0\u4e2a\u5173\u952e\u6b65\u9aa4\u5b9e\u73b0\uff0c\u5305\u542b\u8bbe\u7f6e\u5de5\u4f5c\u7a7a\u95f4 [&hellip;]","protected":false},"author":3,"featured_media":307023,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/307002"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=307002"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/307002\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/307023"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=307002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=307002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=307002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}