[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ledger-smb 1.3 UI utf-8 multi-byte characters e.g. french accented characters as éçà etc
- Subject: Re: ledger-smb 1.3 UI utf-8 multi-byte characters e.g. french accented characters as éçà etc
- From: herman vierendeels <..hidden..>
- Date: Tue, 4 Oct 2011 12:59:52 +0200
I have found a better solution.
In LedgerSMB/Template/HTML.pm
By adding ENCODING => 'UTF-8' parameter when creating new Template, we
arrive at the same result!
$template = Template->new({
INCLUDE_PATH => [$parent->{include_path}, 'UI/lib'],
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
TRIM => 1,
COMPILE_DIR=> $tempdir,
DEBUG => ($parent->{debug})? 'dirs': undef,
DEBUG_FORMAT => '',
ENCODING => 'UTF-8',
}) || throw Error::Simple Template->error();
Herman
2011/10/3 herman vierendeels <..hidden..>:
> Hello Chris,
>
> Yes, i am talking about html-templates.
> Until now, i have not found any html-template with multi-byte
> characters in ledgersmb.
> But in the future, multi-byte characters might turn up into the
> html-templates for one reason or another.
> So we might better be prepared.
> I stumbled upon this problem while trying to understand the template system.
> So i put some french accented characters in the login.html.
> as:
> <body class="login" onload="setup_page('<?lsmb text('Name')?>:',
> '<?lsmb text('Password')?>:');">
> <br /><br />
> tshvr4 test éèçà login.html
> <center>
>
> Altough utf8-encoding is specified in the template,
> subroutine _decode_unicode in package Template::Provider (in
> /usr/lib/perl5/Template/Provider.pm) does not know this
> when physically reading the file.
> (it does not use binmode on reading the file : my $text = <$name>;)
>
> It bases its encoding decision on an eventual BOM found or on the
> parameter ENCODING
> ($self->{ ENCODING } = $params->{ ENCODING };)
> But can we influence this parameter from ledgersmb?
> So i resolved it by letting gvim-editor write a bom-signature to the
> beginning of the file.
>
> I hope this is a bit clear?
>
> Best wishes,
> Herman
>
> Herman
>
>
> 2011/10/3 Chris Travers <..hidden..>:
>> Hi Herman;
>>
>> On Mon, Oct 3, 2011 at 2:50 AM, herman vierendeels
>> <..hidden..> wrote:
>>> I would like to share my experience concerning the display of
>>> multi-byte utf-8 characters.
>>>
>>> I was trying to adapt UI/login.html to my needs with french accented
>>> characters.
>>> But 3 multi-bytes (e.g. éèà) where displalyed as 6 individual characters .
>>>
>>> the bottom-line is that html-files , like UI/login.html e.g. ,
>>> containing multi-byte utf-8 characters , should be written to disk
>>> with
>>> a "byte order mark" BOM at the start of Unicode files.
>>
>> You are talking specifically about the html templates here like
>> UI/login.html, right?
>>
>> If so, what's the best way of setting this in the file? I could write
>> some tests to ensure we don't miss any going forward and modify the
>> templates we do have.....
>>>
>>> reason: subroutine _decode_unicode in package Template::Provider
>>> checks for this !!!
>>>
>>> Maybe a notice concerning "byte order mark" could be dropped in ./doc/faq.html
>>> under item
>>> <p><li><h4>UTF-8 character encoding</h4>
>>> Check also that html-files ,containing multi-byte utf-8 characters,
>>> are written to disk with appropriate "byte order mark" or BOM.
>>>
>>> With vim, you can do this by:
>>> set bomb
>>
>> We specify UTF-8 encoding in the templates so my thinking is if it is
>> not working properly we need to make it work.
>>
>> Best Wishes,
>> Chris Travers
>>
>>>
>>> Greetings,
>>> Herman
>>>
>>> ------------------------------------------------------------------------------
>>> All the data continuously generated in your IT infrastructure contains a
>>> definitive record of customers, application performance, security
>>> threats, fraudulent activity and more. Splunk takes this data and makes
>>> sense of it. Business sense. IT sense. Common sense.
>>> http://p.sf.net/sfu/splunk-d2dcopy1
>>> _______________________________________________
>>> Ledger-smb-devel mailing list
>>> ..hidden..
>>> https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel
>>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure contains a
>> definitive record of customers, application performance, security
>> threats, fraudulent activity and more. Splunk takes this data and makes
>> sense of it. Business sense. IT sense. Common sense.
>> http://p.sf.net/sfu/splunk-d2dcopy1
>> _______________________________________________
>> Ledger-smb-devel mailing list
>> ..hidden..
>> https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel
>>
>