Posting to blogger.com?

Matt Lawrence matt.lawrence at virgin.net
Thu Jun 3 13:56:37 BST 2010


Kieren Diment wrote:
> On 03/06/2010, at 8:06 PM, Steve Mynott wrote:
>
>   
>> On Wed, Jun 02, 2010 at 05:52:40PM +0100, Mark Fowler typed:
>>
>>     
>>> On Wed, Jun 2, 2010 at 4:29 PM, Dave Hodgkinson <davehodg at gmail.com> wrote:
>>>
>>>       
>>>> On 2 Jun 2010, at 21:38, Egor Shipovalov wrote:
>>>>         
>>>>> use File::Slurp;
>>>>>           
>>>> This is the start of most scripts I've been writing recently.
>>>>         
>>> I dumped this since I started using Path::Class all the time.
>>>
>>> my $content = file("something")->slurp
>>>       
>> Does it work with UTF-8?
>>     
>
>
> File::Slurp seems to, or am I missing something:
>
> $ cat > utf
> 김치
> kd at fenchurch>/tmp$ perl -MFile::Slurp -e 'read_file('utf')'
> kd at fenchurch>/tmp$ perl -w -MFile::Slurp -e '$u = read_file("utf"); write_file("u2", $u)'
> kd at fenchurch>/tmp$ cat u2 
> 김치
>   
The real test is whether chr $u > 255. Of course the data is passed 
through correctly whether or not perl understands that it's unicode data.

Matt


More information about the london.pm mailing list