Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning "Wide character in print" when regex contains UTF-8 chars #1

Closed
jonassmedegaard opened this issue Jan 1, 2020 · 3 comments
Closed

Comments

@jonassmedegaard
Copy link

The command-line tools wrongly assume that output contains only ASCII characters.

Recent releases of Regexp::Pattern::License adds some non-ASCII chars (e.g. fancy dashes are sometimes used instead of plain dash-minus, I guess caused by authoring in "fancy" word processors).

Seems best way to handle UTF-8 output, while still playing nice with users of non-utf8 locales, is to add this at the top of the command-line scripts:

use open ':locale';

I don't know, however, if that is supported as far back as 5.010001 now covered.

An alternative is to set binmode, but beware of its limitations as discussed at https://stackoverflow.com/questions/519309/how-do-i-read-utf-8-with-diamond-operator

@perlancar
Copy link
Owner

I believe use open ':locale' is available on 5.10.1.

I'm trying to add use open ':locale' or use open ':utf8' in my CLI framework Perinci::CmdLine::Lite. Could you tell me the command-line which you used to produce the Wide charcter warning?

@jonassmedegaard
Copy link
Author

jonassmedegaard commented Jan 2, 2020 via email

@perlancar
Copy link
Owner

utf8 flag added, will be in next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants