Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81128 > unrolled thread

Re: python 2.7 and unicode (one more time)

Started byEthan Furman <ethan@stoneleaf.us>
First post2014-11-20 13:29 -0800
Last post2014-11-21 00:11 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python 2.7 and unicode (one more time) Ethan Furman <ethan@stoneleaf.us> - 2014-11-20 13:29 -0800
    Re: python 2.7 and unicode (one more time) Marko Rauhamaa <marko@pacujo.net> - 2014-11-21 00:11 +0200

#81128 — Re: python 2.7 and unicode (one more time)

FromEthan Furman <ethan@stoneleaf.us>
Date2014-11-20 13:29 -0800
SubjectRe: python 2.7 and unicode (one more time)
Message-ID<mailman.16058.1416518997.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On 11/20/2014 07:53 AM, Chris Angelico wrote:
> On Fri, Nov 21, 2014 at 2:40 AM, Peter Otten <__peter__@web.de> wrote:
>> I think that you may get a Unicode/Encode/Error when you try to /decode/ a
>> unicode string is more confusing...
> 
> Hang on a minute, what does it even mean to decode a Unicode string?
> That's where the problem is. Fortunately that's one that Py3 solved -
> str simply doesn't have a decode() method.

If your unicode string happens to contain a base64 encoded .png, then you could decode that into bytes.  ;)

--
~Ethan~

[toc] | [next] | [standalone]


#81133

FromMarko Rauhamaa <marko@pacujo.net>
Date2014-11-21 00:11 +0200
Message-ID<871tox8quq.fsf@elektro.pacujo.net>
In reply to#81128
Ethan Furman <ethan@stoneleaf.us>:

> If your unicode string happens to contain a base64 encoded .png, then
> you could decode that into bytes. ;)

You could embed your PNG file in XML in binary form as CDATA. Then, your
"characters" would represent 8- or 16-bit integers. You just need to
replace all accidental occurrences of 

   ]]>

with

   ]]>]]><![CDATA[


Marko

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web