Skip Menu |

This queue is for tickets about the ODF-lpOD CPAN distribution.

Report information
The Basics
Id: 106541
Status: open
Priority: 0/
Queue: ODF-lpOD

People
Owner: Nobody in particular
Requestors: yasuto.sh7 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Control utf8 flag
Date: Thu, 20 Aug 2015 04:40:26 +0900
To: bug-ODF-lpOD [...] rt.cpan.org
From: Yasuto S <yasuto.sh7 [...] gmail.com>
Hi, This is a request. But fix this shortly please. To insert unicode strings, I have to change unicode flag on every strings. Please check flags and change it if necessary. #!/usr/bin/perl use strict; use utf8; use ODF::lpOD; my $doc = odf_new_document('text'); my $meta = $doc->meta; $meta->set_title("Title"); my $text = "こんにちは"; # 'Hello' in Japanese utf8::encode($text); # need this my $context = $doc->get_body; my $p = odf_create_paragraph( text=> $text, style=>"Standard"); $context->insert_element($p);
On 2015-08-19 12:40:36, yasuto.sh7@gmail.com wrote: Show quoted text
> Hi, > This is a request. But fix this shortly please. > > To insert unicode strings, I have to change unicode flag on every strings. > Please check flags and change it if necessary. > > > #!/usr/bin/perl > use strict; > use utf8; > use ODF::lpOD; > > my $doc = odf_new_document('text'); > my $meta = $doc->meta; > > $meta->set_title("Title"); > > my $text = "こんにちは"; # 'Hello' in Japanese > utf8::encode($text); # need this > > my $context = $doc->get_body; > my $p = odf_create_paragraph( > text=> $text, > style=>"Standard"); > > $context->insert_element($p);
Checking the is_utf8 flag on the string is not correct -- but the API should assume that it is receiving characters (unicode), rather than bytes that are already encoded into utf8. It is only when serializing/deserializing at the boundaries of an application that encoding/decoding should occur.
Subject: Re: [rt.cpan.org #106541] Control utf8 flag
Date: Fri, 21 Aug 2015 03:14:43 +0900
To: bug-ODF-lpOD [...] rt.cpan.org
From: Yasuto S <yasuto.sh7 [...] gmail.com>
I think literal strings should be accepted. If I put characters from other streams, I will encode/decode them. Other case, I tried to set Japanese font on paragraph, but it is not worked. (attached file.) Would you tell me how to set font name ? Best Regards. Yasuto, 2015-08-20 5:24 GMT+09:00 Karen Etheridge via RT <bug-ODF-lpOD@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=106541 > > > On 2015-08-19 12:40:36, yasuto.sh7@gmail.com wrote:
> > Hi, > > This is a request. But fix this shortly please. > > > > To insert unicode strings, I have to change unicode flag on every
> strings.
> > Please check flags and change it if necessary. > > > > > > #!/usr/bin/perl > > use strict; > > use utf8; > > use ODF::lpOD; > > > > my $doc = odf_new_document('text'); > > my $meta = $doc->meta; > > > > $meta->set_title("Title"); > > > > my $text = "こんにちは"; # 'Hello' in Japanese > > utf8::encode($text); # need this > > > > my $context = $doc->get_body; > > my $p = odf_create_paragraph( > > text=> $text, > > style=>"Standard"); > > > > $context->insert_element($p);
> > > Checking the is_utf8 flag on the string is not correct -- but the API > should assume that it is receiving characters (unicode), rather than bytes > that are already encoded into utf8. > > It is only when serializing/deserializing at the boundaries of an > application that encoding/decoding should occur. >

Message body is not shown because sender requested not to inline it.

Le Mer 19 Aoû 2015 15:40:36, yasuto.sh7@gmail.com a écrit : Show quoted text
> Hi, > This is a request. But fix this shortly please. > > To insert unicode strings, I have to change unicode flag on every strings. > Please check flags and change it if necessary. > > > #!/usr/bin/perl > use strict; > use utf8; > use ODF::lpOD; > > my $doc = odf_new_document('text'); > my $meta = $doc->meta; > > $meta->set_title("Title"); > > my $text = "こんにちは"; # 'Hello' in Japanese > utf8::encode($text); # need this > > my $context = $doc->get_body; > my $p = odf_create_paragraph( > text=> $text, > style=>"Standard"); > > $context->insert_element($p);
try undef'ing $ODF::lpOD::Common::INPUT_CHARSET after creating / getting the $doc. e.g. the following seems to work for me : use utf8; use ODF::lpOD; my $doc = odf_new_document('text'); undef $ODF::lpOD::Common::INPUT_CHARSET; # needed with 'use utf8' $doc->get_body->insert_element(odf_create_paragraph( text => "こんにちは" )); $doc->save(target => '106541.odt')