How to decode an sqlite 3 file that has Russian text?
(1) By bhuether on 2021-01-18 09:51:28 [link] [source]
Hi, I have a Viber messages database file that contains messages in Russian. No matter what sort of text encoding I choose in, say, Notepad+, it doesn't display the Russian (Cyrillic) characters. I see English messages fine. So I am at a loss as to how I can extract my messages from the database file. Ideas?
(2) By ddevienne on 2021-01-18 10:21:16 in reply to 1 [link] [source]
(5) By Keith Medcalf (kmedcalf) on 2021-01-18 17:35:29 in reply to 2 [link] [source]
That depends how the data was stored. If the database encoding is UTF-8 and the data is passed and retrieved using sqlite3_*_text APIs (which assume UTF-8 encoding) then you "get back" exactly what was provided and that "something" is not required to be UTF-8.
This means that the data can be whatever silly format the person who put it there deemed to use including some 8-bit codepage, MBCS, DBCS, or whatever.
There is actually no requirement that "text" actually be properly formed UTF-8 text -- that constraint only applies if you expect "conversions" within SQLite3 to work properly. If you did not depend on that, then there is no difference between a "text" and a "blob". What you "put" is what you "get".
(3) By Igor Tandetnik (itandetnik) on 2021-01-18 17:11:40 in reply to 1 [source]
Show a sample message, as retrieved with
select hex(message) from messages (substitute your actual table and column names). Perhaps someone would be able to guess at the encoding from the hex dump. Even better if you know what the message is supposed to say, and could provide the corresponding Russian text.
(4) By Stephan Beal (stephan) on 2021-01-18 17:23:55 in reply to 1 [link] [source]
No matter what sort of text encoding I choose in, say, Notepad+, it doesn't display the Russian (Cyrillic) characters.
Are you opening the database in notepad+? If so, that's the problem: the db is a binary file and a text editor won't be able to make any sense of it.
Have you tried something like:
echo .dump | sqlite3 THE_DBFILE > mydb.sql
(Or the equivalent for your platform.)
And then opening the resulting SQL file (as opposed to database file) in notepad+?