http://www.perlmonks.org?node_id=1021903


in reply to How to remove wide chars (ex: 年 or &#x6216) from a text file?

Do you want to remove any code point that is outside the range of normal ASCII text? Do you want to remove any HTML entity that translates to a code point beyond the ASCII range? Both of those could leave big holes in your text.

Or are you asking how to map code points that fall outside of the ASCII range into code points that fall within? If so, what mapping would you prefer? And how would you gracefully downgrade characters that don't have any obvious ASCII approximation?

As you begin to consider and answer (for yourself and for us) those questions, a solution will emerge.


Dave

  • Comment on Re: How to remove wide chars (ex: 年 or &#x6216) from a text file?