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


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

Re: Trouble with utf-8 values

Started byBen Finney <ben+python@benfinney.id.au>
First post2013-11-05 12:36 +1100
Last post2013-11-05 12:36 +1100
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: Trouble with utf-8 values Ben Finney <ben+python@benfinney.id.au> - 2013-11-05 12:36 +1100

#58475 — Re: Trouble with utf-8 values

FromBen Finney <ben+python@benfinney.id.au>
Date2013-11-05 12:36 +1100
SubjectRe: Trouble with utf-8 values
Message-ID<mailman.2039.1383615379.18130.python-list@python.org>
Ulrich Goebel <ml@fam-goebel.de> writes:

> I have an object (a variable) name

This confuses me. Is it an object, a variable, or a name?

> which gets its value from a PostgreSQL database via a SELECT
> statement, an it sometimes has german special characters as ß, ä, ö...

What is the type of that object? You can interrogate Python for the
answer, by using ‘type(foo)’ which will return the type of the object
named by “foo”.

> Then I would like to insert that value into a table in a SQLite
> database. So I make a cursor cur on the table and prepare a SQL
> statement like this:
>
> sql = 'insert into tbl values(?)'
> cur.execute(sql, (name,))

What version of Python are you running?

Do you get different results in Python 2 versus Python 3? One of the
biggest improvements in Python 3 is the proper handling of Unicode, with
more explicit rejection of ambiguity between bytes versus text.

-- 
 \      “The face of a child can say it all, especially the mouth part |
  `\                                        of the face.” —Jack Handey |
_o__)                                                                  |
Ben Finney

[toc] | [standalone]


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


csiph-web