Guenther Schmidt wrote: > let me first of all thank you for providing the HDBC package. Haskell > would be a much, much less usefull language without a working database > interface. I could certainly not have written the app in Haskell > without it and in any other language I know writing this app would have > been much more difficult.
Thanks! I'm glad you found it (and Real World Haskell) helpful. > The problem is what's in the database. > > You'd think there'd be a "Günni" in the database, right? > > Wrong! > > At least this is where your library and Sqlite disagree. Sqlite with any > GUI client doesn't show a "Günni", it shows a "G!$%§$§%nni". So do MS > Access and MySql btw. And now that is REALLY weird, because I can't duplicate it here. I wrote this little Haskell program: import Database.HDBC import Database.HDBC.Sqlite3 main = do dbh <- connectSqlite3 "foo.db" run dbh "CREATE TABLE foo (bar text)" [] run dbh "INSERT INTO foo VALUES (?)" [toSql "Günther"] run dbh "INSERT INTO foo VALUES (?)" [toSql "2-G\252nther"] commit dbh disconnect dbh And when I inspect foo.db with the sqlite3 command-line tool: /tmp$ sqlite3 foo.db SQLite version 3.5.9 Enter ".help" for instructions sqlite> select * from foo; Günther 2-Günther Exactly correct, as expected. I can read it back correctly from Haskell, too: import Database.HDBC import Database.HDBC.Sqlite3 import qualified System.IO.UTF8 as U main = do dbh <- connectSqlite3 "foo.db" results <- quickQuery' dbh "SELECT * from foo" [] mapM_ ((print :: String -> IO ()) . fromSql . head) results mapM_ (U.putStrLn . fromSql . head) results disconnect dbh and when I run this: /tmp$ ./foo3a "G\252nther" "2-G\252nther" Günther 2-Günther I wonder if there is something weird about your environment: non-unicode terminals, databases, editors, or something? For me, it Just Works as it should. > > For now I managed to rollback the UTF8 code in the HDBC-2.1 and got my > app to work as needed. > > I hope you find this info useful, thanks once more > > Günther > > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe