France,
Toulouse,
Thursday, May, 4th, 2006,
12:31 am.

Hi Charles,


You said:

> that it works is of course the best test.

That's true. :)

I was just wondering if it was really useful to convert into UTF-8.
Maybe there is an automatically conversion from ASCII to UTF-8 while you are
inserting the data into tables.

Note:
I forgot the Str( userID ) where userID is an Integer.
So the REALbasic statement is:

    UsersDB.SQLExecute( "UPDATE UserAccounts SET Password = """ +
ConvertEncoding( EncodeBase64( MD5( aPassword ), 0 ), Encodings.UTF8 ) + """
WHERE ID = " + Str( userID ) )

I think there is an automatic conversion process when REALbasic build the
final string before SQL execution. Str( ) should return an UTF-8 string. If
I'm not wrong, when REALbasic has to merge ASCII and UTF-8 strings, it
convert every ASCII strings into UTF-8 strings, then it concatenates every
strings.


Best Regards,


Nils

----

Le 4/05/06 0:00, « [NOM] » <[ADRESSE]> a écrit :

> It looks correct to me; that it works is of course the best test.
> 
> Charles Yeomans
> 
> On May 3, 2006, at 5:49 PM, Nils Frisch wrote:
> 
>> France,
>> Toulouse,
>> Wednesday, May, 3rd, 2006,
>> 11:48 pm.
>> 
>> 
>> Hi Charles,
>> 
>> 
>> As always, thank you very much for your help.
>> 
>> Here how I write the code:
>> 
>>     UsersDB.SQLExecute( "UPDATE UserAccounts SET Password = """ +
>> ConvertEncoding( EncodeBase64( MD5( aPassword ), 0 ),
>> Encodings.UTF8 ) + """
>> WHERE ID = " + userID )
>> 
>> I hash the password with the MD5 method.
>> Then I encode the hashed password with EncodeBase64 which returns
>> an ASCII
>> string.
>> I convert this ASCII string into UTF-8 string since the
>> REALSQLDatabase
>> prefers UTF-8 encoded strings.
>> 
>> Is that correct ?
>> For the moment, that works fine and resolves my problem.
>> Thanks.
>> 
>> 
>> Have a very nice day,
>> 
>> 
>> Nils
>> 
>> ----
>> 
>> Le 3/05/06 2:59, « [NOM] » <[ADRESSE]> a écrit :
>> 
>>> Encode the MD5 hash using EncodeBase64, which returns an ASCII
>>> string.
>>> 
>>> Charles Yeomans
>>> 
>>> 
>>> On May 2, 2006, at 8:50 PM, Nils Frisch wrote:
>>> 
>>>> Hi Everybody,
>>>> 
>>>> I would like to know the best way for storing passwords treated by
>>>> the MD5
>>>> function.
>>>> I noted that MD5 returns strings without text encoding:
>>>> 
>>>>     MD5( aString ).Encoding = Nil
>>>> 
>>>> REALSQLDatabase usually store UTF-8 strings. So I should convert
>>>> the MD5
>>>> function's result into UTF-8 encoding. But before that I have to
>>>> define an
>>>> encoding. Is it ISOLatin1 ?
>>>> 
>>>> If I store the MD5 version of the password directly into the
>>>> database
>>>> (without encoding treatment), I could meet some problem. For
>>>> example, if the
>>>> password is:
>>>> 
>>>>     aaaa
>>>> 
>>>> The MD5 version is (displayed by MsgBox):
>>>> 
>>>>     t½s7EBŒ²?ğf=‰Â
>>>> 
>>>> This cause a database error:
>>>> 
>>>>     error code: 1
>>>>     error message: Incomplete SQL statement
>>>> 
>>>> It's because of the quotes generated by the MD5 function.
>>>> 
>>>> What is the best strategy ?
>>>> 
>>>> I have also an underlying question.
>>>> What is the best strategy to store data including quote symbols ?
>>>> Have I to use the ReplaceAll method to twin every quotes ?
>>>> For example:
>>>> 
>>>>     aStringToStore = aStringToStore.ReplaceAll( """", """""" )
>>>>     aStringToStore = aStringToStore.ReplaceAll( "'", "''" )
>>>>     aStringToStore = aStringToStore.ReplaceAll( "Œ", "ŒŒ" )
>>>> 
>>>> And so on.
>>>> 
>>>> Thank you for your ideas.
>>>> 
>>>> 
>>>> Have a good day,
>>>> 
>>>> 
>>>> Nils
>>>> 
>>>> ----
>>>> 
>>>> Nils Frisch
>>>> 
>>>> http://www.nils-frisch.com/
>>>> 
>>>> Toulouse,
>>>> France.
>> 
>> ----
>> 
>> Nils Frisch
>> 
>> http://www.nils-frisch.com/
>> 
>> Toulouse,
>> France.

----

Nils Frisch

http://www.nils-frisch.com/

Toulouse,
France.



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to