How string are stored

Jules Jacquot Jules.Jacquot at wanadoo.fr
Sat Aug 2 15:07:59 CDT 2003


Le samedi, 2 aoû 2003, à 13:14 Europe/Paris, Ruslan Zasukhin a écrit :

> on 8/2/03 11:46, Vincent Mercey at vmercey at free.fr wrote:
>
> Hi Vincent,
>
>> My goal is to have a crossplateform database (Mac 9, Mac X and 
>> Windows)
>>
>> I have noticed that, when storing a string with characters > 127 on
>> MacOS, I retrieve it without any problem on Windows and vice-versa.
>> So, I guess that data is stored in only one encoding and that there 
>> is a
>> conversion (I think that the encoding is Mac and that the conversion 
>> is
>> done on Windows)
>
> No, strings are stored in the platform specific format.
>
> When Valentina is run on windows and it see that db files from MAC, 
> then on
> the fly it do conversion.
>
> Actually right now this conversion map works for Roman languages.
> For other language it should be other.

Unicode is universal
if you want to have a crossplateform use encodings.MacRoman

when you are reading the datas coming from Mac 9, use 
defineencoding(db.field(".."),encodings.macRoman) (mac X and windows)
when you update or add a record in X or Windows use
convertencoding(editfield.text,encodings.macRoman)
and then, you will have a crossplateform
Mac 9, X and windows can deal with the unique database which is 
"encodings.MacRoman".
>
>
>> You know that, now, RealBasic 5.2 uses UTF8 encoding in its internal 
>> strings.
>>
>> First) If I store string in UTF8 with a Mac, can I retrieve it with a
>> Windows application ?
>
> I afraid this conversion map can damage something, because UTF8 do not 
> need

> conversion correct?

Mac 9 hasn't encode. That is why you must to convert in MacRoman if you 
want to use his database.

best

jules


More information about the Valentina mailing list