Re: [sqlite] SQLite - macOS

2019-09-23 Thread Jens Alfke


> On Sep 23, 2019, at 9:53 AM, Pierre Clouthier 
>  wrote:
> 
>   sqlite3_exec("PRAGMA encoding = \"UTF-8\";") 

That isn't necessary. SQLite defaults to UTF-8.

In most cases SQLite doesn't interpret the byte sequences in a string. It just 
knows it's using an 8-bit character set and leaves it at that. So if the text 
is messed up in the database, it's because it was entered in messed-up form.

(Some components do work with non-ASCII text, like FTS, depending on how you've 
built/configured SQLite, and those do interpret UTF-8 sequences.)

—Jens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite - macOS

2019-09-23 Thread Richard Damon

> On Sep 23, 2019, at 1:25 PM, Simon Slavin  wrote:
> 
>> On 23 Sep 2019, at 5:53pm, Pierre Clouthier  
>> wrote:
>> 
>> Can anyone explain how to write UTF-8 in SQLite on the Mac?
>> 
>> We use this statement:
>> 
>>  sqlite3_exec("PRAGMA encoding = \"UTF-8\";") 
> 
> This is not a SQLite problem, but a problem with escaping the quotes in 
> language you're using to execute sqlite3 calls.
> 
> What programming language or script system are you using ?  Will it accept 
> any other way to escape the quote marks ?
> 
> It should be possible to find a line of code which works on all platforms 
> your compiler supports.
> 
My guess is that it isn’t a language issues, as it sounds like they are working 
on a multi-platform  program, but that they are reading in a file that isn’t 
UTF-8 and trying to insert it directly (and getting a Unicode coding error 
because the data isn’t UTF-8), or the file IS UTF-8 but they don’t think it is 
so they run a conversion on it to convert to UTF-8 from some other character 
set, and that is throwing an unrecognized character error.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite - macOS

2019-09-23 Thread Igor Korot
Hi,

On Mon, Sep 23, 2019 at 11:58 AM Pierre Clouthier
 wrote:
>
> Can anyone explain how to write UTF-8 in SQLite on the Mac?
>
> We use this statement:
>
> sqlite3_exec("PRAGMA encoding = \"UTF-8\";")

You should probably use this inside

#ifdef _WINDOWS  #endif

Thank you.

>
> This works fine on Windows, but on macOS the data is not being stored
> correctly.
>
> The data to be written (passed to SQLite), is formatted in UTF-8.
>
> For example, 'é' is U+00E9, which in UTF-8 is 0xC3A9. However, in the
> macOS version of the database, it is converted to 0xEFBFBD, which is
> U+FFFD, which doesn't make sense.
>
> --
> Progeny Genealogy Inc. 902–681–3102
> Progeny helps you tell the Story of Your Family ™
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite - macOS

2019-09-23 Thread Simon Slavin
On 23 Sep 2019, at 5:53pm, Pierre Clouthier  
wrote:

> Can anyone explain how to write UTF-8 in SQLite on the Mac?
> 
> We use this statement:
> 
>   sqlite3_exec("PRAGMA encoding = \"UTF-8\";") 

This is not a SQLite problem, but a problem with escaping the quotes in 
language you're using to execute sqlite3 calls.

What programming language or script system are you using ?  Will it accept any 
other way to escape the quote marks ?

It should be possible to find a line of code which works on all platforms your 
compiler supports.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite - macOS

2019-09-23 Thread Richard Damon
Not sure what you code is doing, and you aren’t showing how you are getting 
your 'é' into SQLite, but U+FFFD is the standard character for malformed data, 
so something somewhere is complaining about converting something into UTF-8. 

Also, you CAN’T have a UTF-8 value like 0xC3A9, as that is not a byte value. 
U+00E9 expressed in UTF-8 would be 0xC3, 0xA9 (Two separate bytes), if you try 
to talk about it in some bigger word you are no longer talking UTF-8, and 
introducing all sorts of machine specifies (Big vs Little Endian, word size, 
etc).

> On Sep 23, 2019, at 12:53 PM, Pierre Clouthier 
>  wrote:
> 
> Can anyone explain how to write UTF-8 in SQLite on the Mac?
> 
> We use this statement:
> 
>   sqlite3_exec("PRAGMA encoding = \"UTF-8\";") 
> This works fine on Windows, but on macOS the data is not being stored 
> correctly.
> 
> The data to be written (passed to SQLite), is formatted in UTF-8.
> 
> For example, 'é' is U+00E9, which in UTF-8 is 0xC3A9. However, in the macOS 
> version of the database, it is converted to 0xEFBFBD, which is U+FFFD, which 
> doesn't make sense.
> 
> -- 
> Progeny Genealogy Inc. 902–681–3102
> Progeny helps you tell the Story of Your Family ™
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite - macOS

2019-09-23 Thread Pierre Clouthier

Can anyone explain how to write UTF-8 in SQLite on the Mac?

We use this statement:

   sqlite3_exec("PRAGMA encoding = \"UTF-8\";") 

This works fine on Windows, but on macOS the data is not being stored 
correctly.


The data to be written (passed to SQLite), is formatted in UTF-8.

For example, 'é' is U+00E9, which in UTF-8 is 0xC3A9. However, in the 
macOS version of the database, it is converted to 0xEFBFBD, which is 
U+FFFD, which doesn't make sense.


--
Progeny Genealogy Inc. 902–681–3102
Progeny helps you tell the Story of Your Family ™


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users