How do I escape a Unicode string with Ruby?

前端 未结 6 910
春和景丽
春和景丽 2020-12-14 22:10

I need to encode/convert a Unicode string to its escaped form, with backslashes. Anybody know how?

6条回答
  •  被撕碎了的回忆
    2020-12-14 22:51

    You can directly use unicode characters if you just add #Encoding: UTF-8 to the top of your file. Then you can freely use ä, ǹ, ú and so on in your source code.

提交回复
热议问题