How to ensure that Strings are in UTF-8?

前端 未结 2 1235
青春惊慌失措
青春惊慌失措 2021-02-15 14:07

How to convert this String the surveyÂ’s rules to UTF-8 in Scala?

I tried these roads but does not work:

scala> val text =         


        
2条回答
  •  礼貌的吻别
    2021-02-15 14:21

    Just set the JVM's file.encoding parameter to UTF-8 as follows:

    -Dfile.encoding=UTF-8
    

    It makes sure that UTF-8 is the default encoding.

    Using scala it could be scala -Dfile.encoding=UTF-8.

提交回复
热议问题