Advertisement
Guest User

Untitled

a guest
Oct 30th, 2018
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import sqlite3
  2.  
  3. with sqlite3.connect('test3.db') as conn:
  4. conn.execute("PRAGMA encoding = 'UTF-16'")
  5. c = conn.cursor()
  6. c.execute("PRAGMA encoding")
  7. print("Initial", c.fetchall())
  8. conn.commit()
  9.  
  10. with sqlite3.connect('test3.db') as conn:
  11. c = conn.cursor()
  12. c.execute("PRAGMA encoding")
  13. print("Encoding", c.fetchall())
  14. print("After trying to change to UTF-8")
  15. c.execute("PRAGMA encoding = 'UTF-8'")
  16. conn.commit()
  17.  
  18. c.execute("PRAGMA encoding")
  19. print("Encoding", c.fetchall())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement