unicode, bytes redux

John Machin sjmachin at lexicon.net
Mon Sep 25 10:11:32 EDT 2006


Fredrik Lundh wrote:
> John Machin wrote:
>
> > Actually, what Willie was concerned about was some cockamamie DBMS
> > which required to be fed Unicode, which it encoded as UTF-8, but
> > silently truncated if it was more than the n in varchar(n) ... or
> > something like that.
> >
> > So all he needs is a boolean result: u.willitfit(encoding, width)
>
> at what point in the program would that method be used ?

Never, I hope. Were you taking that as a serious suggestion? Fredrik,
perhaps your irony detector needs a little preventative maintenance :-)

>
> how large are the strings, for typical cases ?

He did mention it several posts ago -- I recall varchar(50) or
something like that. IOW as Duncan Booth said in effect at the start of
the 1st thread, the OP's got more problems that just doubling up on
u.encode('utf8') ...

Cheers,
John




More information about the Python-list mailing list