[Freeipa-users] What does the "u" mean in IPA messages?

KodaK sakodak at gmail.com
Thu Feb 28 22:34:38 UTC 2013


On Thu, Feb 28, 2013 at 3:27 PM, John Dennis <jdennis at redhat.com> wrote:
> On 02/28/2013 04:18 PM, KodaK wrote:
>>
>> When performing an operation with the IPA tools, I get a message every
>> time similar to this:
>>
>> ipa: INFO: Forwarding 'hbactest' to server u'https://ipaserver/ipa/xml'
>>
>> What does it mean?  I've never seen it say anything other than "u"
>> (that I've noticed.)  A pointer to documentation is preferred, but
>> I've been looking and haven't found anything.  (Lots of stuff on the
>> International Phonetic Alphabet's use of "u" though.  I think I'm
>> qualified to edit dictionaries now.)
>
>
> It means unicode, It's a Python'ism. In Python2 there are two different
> string types str and unicode. str's are have 8-bit characters, unicode have
> wide characters (either 16-bit UCS2 or 32-bit UCS4) depending on how Python
> was built (unicode is UCS4 on our builds). Since IPA in internationalized we
> use unicode for all strings.
>
> What the u prefix is telling you is the type of the string. The only reason
> you see it is because in some places we use the repr method to output string
> data and the repr method prefixes unicode with a u character. We've been
> fixing places where repr method is used, not sure if this is one of those or
> not. We were using repr because early on we were not consistent with whether
> we used str's or unicode objects and it was handy to know the difference,
> it's not so much of an issue any more.

Ah, thanks for the explanation.  If I build parsing scripts for
things, is the "u" going to disappear in the future with the
discontinuation of the repr method?  (That's what set this off in the
first place.)




More information about the Freeipa-users mailing list