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


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

RE: COnvert to unicode

Started byJoaquin Alzola <Joaquin.Alzola@lebara.com>
First post2016-04-07 23:23 +0000
Last post2016-04-07 23:23 +0000
Articles 1 — 1 participant

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: COnvert to unicode Joaquin Alzola <Joaquin.Alzola@lebara.com> - 2016-04-07 23:23 +0000

#106654 — RE: COnvert to unicode

FromJoaquin Alzola <Joaquin.Alzola@lebara.com>
Date2016-04-07 23:23 +0000
SubjectRE: COnvert to unicode
Message-ID<mailman.67.1460098875.2253.python-list@python.org>
Thanks Peter. Much appreciate will look into codecs and how they work.

-----Original Message-----
From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara.com@python.org] On Behalf Of Peter Otten
Sent: 07 April 2016 19:14
To: python-list@python.org
Subject: Re: COnvert to unicode

Joaquin Alzola wrote:

> Hi People
>
> I need to covert this string:
>
> hello  there
> this is a test
>
> (also \n important)
>
> To this Unicode:
>
00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a
> Without the \u and space.
>
> https://www.branah.com/unicode-converter
>
> I seem not to be able to do that conversion.
>
> Help to guide me will be appreciated.

>>> import codecs
>>> s = u"hello  there\nthis is a test\n"
>>> codecs.encode(s.encode("utf-16-be"), "hex")
'00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a'


--
https://mail.python.org/mailman/listinfo/python-list
This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt.

[toc] | [standalone]


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


csiph-web