From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] buildhistory.bbclass: Specify lang in decoding strings
Date: Sat, 28 Dec 2013 22:52:18 +0000 [thread overview]
Message-ID: <5069586.lVvcYzeSdC@helios> (raw)
In-Reply-To: <1386375114-7702-1-git-send-email-raj.khem@gmail.com>
On Friday 06 December 2013 16:11:54 Khem Raj wrote:
> On systems where default locale is utf-8 we get errors like
>
> File: 'buildhistory.bbclass', lineno: 38, function: write_pkghistory
> 0034: if pkginfo.rconflicts:
> 0035: f.write("RCONFLICTS = %s\n" % pkginfo.rconflicts)
> 0036: f.write("PKGSIZE = %d\n" % pkginfo.size)
> 0037: f.write("FILES = %s\n" % pkginfo.files)
> *** 0038: f.write("FILELIST = %s\n" % pkginfo.filelist)
> 0039:
> 0040: for filevar in pkginfo.filevars:
> 0041: filevarpath = os.path.join(pkgpath, "latest.%s" % filevar)
> 0042: val = pkginfo.filevars[filevar]
> Exception: UnicodeEncodeError: 'ascii' codec can't encode character
> u'\xed' in position 337: ordinal not in range(128)
>
> This patch specifies decode to use utf-8 so ascii and utf-8 based
> locales both work
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> meta/classes/buildhistory.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/buildhistory.bbclass
> b/meta/classes/buildhistory.bbclass index 1e6d968..4ff39a0 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -190,7 +190,7 @@ python buildhistory_emit_pkghistory() {
> key = item[0]
> if key.endswith('_' + pkg):
> key = key[:-len(pkg)-1]
> - pkgdata[key] = item[1].decode('string_escape')
> + pkgdata[key] = item[1].decode('utf-8', 'string_escape')
>
> pkge = pkgdata.get('PKGE', '0')
> pkgv = pkgdata['PKGV']
Khem, did you test that this actually works? Here it does not - I get strings
with \n \t in them; reverting this change makes it interpret these as it
should.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
next prev parent reply other threads:[~2013-12-28 22:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-07 0:11 [PATCH] buildhistory.bbclass: Specify lang in decoding strings Khem Raj
2013-12-28 22:52 ` Paul Eggleton [this message]
2014-01-23 18:26 ` Paul Eggleton
2014-01-23 18:59 ` Khem Raj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5069586.lVvcYzeSdC@helios \
--to=paul.eggleton@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=raj.khem@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox