[Padre-dev] Document cannot be saved if it has CJK characters.

Adam Kennedy adamkennedybackup at gmail.com
Thu Nov 27 16:24:01 PST 2008


I get the feeling we need to abandon File::Slurp. It doesn't buy us a
whole lot, adds a dependency, and adds another layer of indirection
between us and what is actually happening when writing to disk.

Adam K

2008/11/27 Keedi Kim <keedi at perl.kr>:
> Hi, :-)
>
> On my linux box which locale is ko_KR.UTF-8,
> Padre cannot save document if it has CJK characters.
>
> If I wrote perl script with only english characters, everything is ok.
> But If I put Hangul(Korean Characters) and save it,
> then following error message occurs and cannot save document:
>
> Could not save: Wide character in syswrite at
> /usr/local/share/perl/5.8.8/File/Slurp.pm line 330.
>
> Padre::Document.pm:
>> sub save_file {
>>     ...
>>     require File::Slurp;
>>     eval {
>>         File::Slurp::write_file($filename, {binmode => ':raw'}, $content);
>>     };
>>     ...
>> }
>
> To escape this problem, I have to set binmode and encode contents:
>> eval {
>>     use Encode 'encode';
>>     File::Slurp::write_file($filename, {binmode => ':utf8'},
>> encode('utf-8', $content));
>> };
>
> That is not an answer since not all users use utf-8.
> And I think Padre might need ability that saving documents
> with another encodings which includes:
>
> 1. encoding of document (default?)
> 2. or Padre default settings
> 3. or user could select.
>
> Thanks, :-)
>
> --
> Best regards,
>
> Keedi Kim
>
>
> _______________________________________________
> Padre-dev mailing list
> Padre-dev at perlide.org
> http://mail.perlide.org/mailman/listinfo/padre-dev
>
>


More information about the Padre-dev mailing list