Encode String to UTF-8

后端 未结 11 1931
忘掉有多难
忘掉有多难 2020-11-22 08:33

I have a String with a \"ñ\" character and I have some problems with it. I need to encode this String to UTF-8 encoding. I have tried it by this way, but it doesn\'t work:

11条回答
  •  借酒劲吻你
    2020-11-22 09:19

    A quick step-by-step guide how to configure NetBeans default encoding UTF-8. In result NetBeans will create all new files in UTF-8 encoding.

    NetBeans default encoding UTF-8 step-by-step guide

    • Go to etc folder in NetBeans installation directory

    • Edit netbeans.conf file

    • Find netbeans_default_options line

    • Add -J-Dfile.encoding=UTF-8 inside quotation marks inside that line

      (example: netbeans_default_options="-J-Dfile.encoding=UTF-8")

    • Restart NetBeans

    You set NetBeans default encoding UTF-8.

    Your netbeans_default_options may contain additional parameters inside the quotation marks. In such case, add -J-Dfile.encoding=UTF-8 at the end of the string. Separate it with space from other parameters.

    Example:

    netbeans_default_options="-J-client -J-Xss128m -J-Xms256m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dfile.encoding=UTF-8"

    here is link for Further Details

提交回复
热议问题