[V4RB] SQL Queries/RB5.1/Unicode
Stan R. Busk
maxprog at mac.com
Fri Apr 25 19:57:09 CDT 2003
Hi,
I have tried both methods unsuccessfully. The query works fine as long
as the queried valentina vvarchar field doesn't contain any accented
characters. For example one record contains the word 'metá'. If you
look for records containing 'met' velentina returns a cursor with the
correct record. If you then look for 'metá', resulting cursor comes
empty. Both words 'met' and 'metá' are taken from an edit field. There
is no change if I try to convert from UTF8 to MacRoman, or guessing
both encodings first or to default system encoding (0).
Stan
> I use a function
>
> function UniCodetoASCII(char as string) string
> Dim c as TextConverter
> Dim t as TextEncoding
>
> t=Char.Encoding
>
> if t=NIL then
> return char
> else
> c=GetTextConverter(GetTextEncoding(t.base,t.variant,t.format),
> GetTextEncoding(0))
> return c.convert(Char)
> end if
> end function
>
> OR
>
> function ForceASCII(char as string) string
> return char.ConvertEncoding( Encodings.SystemDefault )
> end function
>
> bye
>
>
> Claudius
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>
>
>
>
>> Hi,
>>
>> New RB5.1 uses Unicode UTF8 everywhere, this is great! But when you
>> take a string from an edit field to be part of an SQL query and this
>> string contains an accentuated character, it always returns 0 entries
>> found (works fine with raw ASCII characters though). I have tried to
>> convert this string in many ways unsuccessfully, basically from UTF8
>> to MacRoman. I almost tried everything getting wrong results like
>> char "à" converted to "a'" and so on...
>>
>> When I guess a Valentina VVarchar field encoding it returns
>> Base=&hA01 with Variant=0 when it contains no accentuated chars but
>> nil when it does!
>>
>> I know UTF8 support is being added to Valentina and I will likely
>> then convert all my database strings to it but on the meantime I
>> would like to know how could I make it work with my current database
>> strings, basically how can I take an UTF8 string and add it to my SQL
>> query securely?
>
--
MAX Programming, LLC
<http://maxprog.com>
More information about the Valentina
mailing list