[V4RB] Different results with SQL and BaseObject

jda jda at his.com
Tue Apr 15 08:52:00 CDT 2003


>on 4/15/03 12:36 AM, Christer Olsson at christer at ljusaideer.se wrote:
>
>Hi Christer,
>
>>  When storing strings containing ASCII > 127 I get different 
>>results when using
>>  SQLExecute and BaseObject Record methods. I'm storing values entered by the
>>  user in editfields, and I convert them to MacRoman before storing them with:
>>
>>  s = convertEncoding(value, encodings.macRoman)
>>
>>  This will store a "raw" UTF string in the database:
>>
>>  recCount = app.mEOrderDatabase.SQLExecute("UPDATE Installningar 
>>SET varde_fld
>>  = '" + s  + "' WHERE namn_fld = " + falt)

I think that RB changes the "s" back to unicode here, because it is 
inserted into a literal string, which is UTF-8.

>  >
>>  But this will store MacRoman encoded strings:
>>
>>  app.mEOrderDatabase.mInstallningar.vardeFld.SetString(s)
>>  app.mEOrderDatabase.mInstallningar.namnFld.SetString(falt)
>>  app.mEOrderDatabase.mInstallningar.AddRecord

Here you are storing MacRoman for sure.

>  >
>>  i.e if the Editfield.text is "Lösenord" the SQLExecute will store 
>>"Lˆsenord",
>>  but the BaseObject method will store "Lösenord".

That's the correct behavior (nothing to do with Valentina). With 
SQLExecute you are storing UTF-8, with the baseobject you are storing 
MacRoman.

You can see if I'm right about the "s" being converted back to UTF-8 
by performing a "GuessJapaneseEncoding" on the string you are sending 
toe SQLExecute and, in the debugger, seeing what RB thinks the 
string's encoding is.


Jon


More information about the Valentina mailing list