EntropyOrg / p5-Devel-IPerl

:microscope::books: Perl5 language kernel for Jupyter <http://jupyter.org/>
http://p3rl.org/Devel::IPerl
93 stars 15 forks source link

Setting standard stream and source encoding to UTF-8 #92

Closed dlukes closed 3 years ago

dlukes commented 6 years ago

Trying to print accented UTF-8 characters, I get the "Wide character in print" warning:

print "žůžová čtvrteční řácká kúra"
# prints: žůžová čtvrteční řácká kúra
# and warns: Wide character in print at reply input line 1.

I know how to solve this in a script:

use utf8;  # set source encoding
use open qw(:std :encoding(UTF-8));  # set encoding of standard streams

Is there a way to hook this setup into IPerl? I tried modifying the perl arguments (adding -Mutf8 -Mopen qw(:utf8 :encoding(UTF-8))) in kernel.json, but that file keeps getting overwritten each time IPerl is started.

As a temporary workaround, I hardcoded the arguments into the iperl command line wrapper, but that's obviously not the right way to do it :) Any recommendations as to how to do it right? Or is it simply not supported currently?

zmughal commented 3 years ago

Fixed by commit https://github.com/EntropyOrg/p5-Devel-IPerl/commit/17691a425d45bc58b036efa7a6b5856c8e571579.

Thanks @dlukes!