3

I got this SQL statement that I wish to run on SQLite:

INSERT INTO tEntity (name) VALUES ('Roger Café');

Note the é character. Using the SQLite browser, I can insert this statement with the proper encoding.

However, if I save the above statement as a file (my.sql) and then run it on the Windows command line, I am having an encoding problem. The é in Café is garbled up.

C:\somewhere> sqlite3.exe my.db
sqlite> .read my.sql

I'm using Notepad++ to create the file in ANSI encoding. I have tried to use UTF-8 encoding but sqlite3.exe gives me a syntax error while reading the SQL file.

Is there any solution to fix this?

4
  • Could you please trim your SQL down to the fields required to reproduce the problem? Commented Aug 16, 2012 at 7:30
  • How did you run in your console? Just tried the same thing but it seems to work. care to show us your environment variables, too? Commented Aug 16, 2012 at 7:40
  • I save the sql statement using notepad ++ in ANSI mode. Then in the console,.read the sql file. I am just using a plain sqlite3 in windows Commented Aug 16, 2012 at 7:50
  • What kind of error did you get when you tried utf-8 with notepad++? I assume your .sql file has different encoding. (I have no idea about windows, but é worked on my linux box) Commented Aug 16, 2012 at 7:59

1 Answer 1

1

The encoding UTF-8 in notepad++ has BOM, which sqlite3.exe does not know about. Try using UTF-8 without BOM.

Sign up to request clarification or add additional context in comments.

1 Comment

ok it works now, after converting everything to UTF-8 without BOM. Arigato Gozaimasu

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.