How to convert large UTF-8 strings into ASCII?

前端 未结 9 1759
盖世英雄少女心
盖世英雄少女心 2020-12-18 08:29

I need to convert large UTF-8 strings into ASCII. It should be reversible, and ideally a quick/lightweight algorithm.

How can I do this? I need the source

9条回答
  •  余生分开走
    2020-12-18 08:57

    It is impossible to convert an UTF-8 string into ASCII but it is possible to encode Unicode as an ASCII compatible string.

    Probably you want to use Punycode - this is already a standard Unicode encoding that encodes all Unicode characters into ASCII. For JavaScript code check this question

    Please edit you question title and description in order to prevent others from down-voting it - do not use term conversion, use encoding.

提交回复
热议问题