I have a file that contains text. The file is not a text file, it is a SQL file.

I want to open this file with the UTF-8 encoding in order to copy and paste the texts. So far, I'm trying to do it with TeXShop but this app refuses to use the encoding I'm selecting.

Do you know any other software that I could try and use?

  • TextEdit maybe? – nohillside Sep 30 '16 at 11:22
  • Nope it does not work, I guess because the file is not a text file... – Colas Sep 30 '16 at 11:27
  • What exactly is a SQL file for you, how was it created in the first place? What is the result of running file FILENAME in Terminal? – nohillside Sep 30 '16 at 11:34
  • It is SQLite 3.x database. The file is created by Core Data... – Colas Sep 30 '16 at 11:36
  • 1
    This is the kind of thing that BBEdit was made for. barebones.com/products/bbedit – Ɱark Ƭ Sep 30 '16 at 11:55

This is the kind of thing that BBEdit was made for. BBEdit will open any file and generally do an excellent job of displaying any embedded text. There is even a menu in the bottom control area for every file that allows you to force a particular text encoding. When I first bought BBEdit it was about $130. At its current price of $50 its a steal. I have no affiliation with Barebones Software, except as a satisfied customer.


  • 1
    TextWrangler can normally do the same thing for free. – Tom Gewecke Sep 30 '16 at 12:58
  • (it worked but not through the menu in the bottom bar) – Colas Sep 30 '16 at 13:05
  • 1
    @Colas, there is usually more than one way to do it in BBEdit. Glad it worked for you. – Ɱark Ƭ Sep 30 '16 at 13:11
  • @TomGewecke, BBEdit has a new business model. It will be fully functional for 30 days and after that will support a reduced feature set. I expect TextWrangler to go away like "BBEdit Lite" did. See the BBEdit 11.6 release notes, sixth paragraph down. barebones.com/company/press/bbedit116_pr.html – Ɱark Ƭ Sep 30 '16 at 13:15

emacs has a hex editor if you are hardcore enough to edit database like that. are you sure you want to do that?

UPD: are you looking for https://stackoverflow.com/questions/18259692/how-to-recover-a-corrupt-sqlite3-database ?

A radical answer addressing the root cause (the database corruption) involves running the database backend in a different address space than the client app. But that would be an expensive revamp.

  • Anyway, the file is corrupted and has 0 record now... But I can still see the data if I open it in a text editor. – Colas Sep 30 '16 at 12:04
  • Ok, are you sure an editor, hex, utf-8 or whatever is the right tool for the job? Ain't there a band aid such as an fsck equivalent for sqlite databases? – Anton Tropashko Sep 30 '16 at 12:07
  • I'm not sure of anything but the best I've found so far is BBedit. Thanks for your help! – Colas Sep 30 '16 at 12:18
  • if you are doing web why not. it seems to be geared towards that. – Anton Tropashko Sep 30 '16 at 12:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .