Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problem with format string and unicode

Reply
Thread Tools

Problem with format string and unicode

 
 
Hans Martin
Guest
Posts: n/a
 
      03-28-2008
Hi,

this is probably a trivial problem, but a google search for "python"
and "unicode" and" format string" gives too many hits: If I specify
e.g. "%20s" in a format string and the string value contains UTF-8
stuff (differing number of bytes per character), the length of the
resulting string (in characters) varies. How can I fix this?

Many thanks in advance!

--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
 
Reply With Quote
 
 
 
 
Marc 'BlackJack' Rintsch
Guest
Posts: n/a
 
      03-28-2008
On Fri, 28 Mar 2008 21:13:00 +0100, Hans Martin wrote:

> this is probably a trivial problem, but a google search for "python"
> and "unicode" and" format string" gives too many hits: If I specify
> e.g. "%20s" in a format string and the string value contains UTF-8
> stuff (differing number of bytes per character), the length of the
> resulting string (in characters) varies. How can I fix this?


Use unicode strings instead.

Ciao,
Marc 'BlackJack' Rintsch
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: raw format string in string format method? Chris Angelico Python 3 03-01-2013 12:00 AM
Re: raw format string in string format method? Rick Johnson Python 0 02-28-2013 11:06 PM
Re: raw format string in string format method? Peter Otten Python 0 02-28-2013 03:41 PM
Help for Unicode char and Unicode char based string in Ruby Chirag Mistry Ruby 6 02-08-2008 12:45 PM
Unicode digit to unicode string Gabriele *darkbard* Farina Python 2 05-16-2006 01:15 PM



Advertisments