Hi everybody hi try to fill a weblistbox with a single table data, but the data have some character like or % or $ " etc etc
y tray all encoding but not succes i read also some post and tray the samples but still have same problem
some body hace some sugest
the database is sql server using this encoding Modern_Spanish_CI_AS
my sample code, any help be will apreciated tks
[code]Dim data as RecordSet
mdb.SQLExecute(“set names utf8 collate utf8_spanish_ci”)
mDb.SQLExecute(“set character set utf8”)
data = mDB.SQLSelect(sql)
If mDB.Error Then
MsgBox("DB Error: " + mDB.ErrorMessage)
Return
End If
GrdSucu.DeleteAllRows
GrdSucu.ColumnCount = data.FieldCount
For I = 1 To data.FieldCount
GrdSucu.Heading(I-1)= data.IdxField(I).StringValue.ConvertEncoding(Encodings.UTF8)
''GrdSucu.Heading(I-1) = data.IdxField(I).StringValue.DefineEncoding(Encodings.UTF8)
Next
If data <> Nil Then
While Not data.EOF
GrdSucu.AddRow("")
For M = 0 to data.FieldCount -1
GrdSucu.Cell(GrdSucu.LastIndex, M) = data.IdxField(M+1).StringValue.DefineEncoding(Encodings.UTF8)
Next
data.MoveNext
Wend
data.Close[/code]
this line
GrdSucu.Heading(I-1)= data.IdxField(I).StringValue.ConvertEncoding(Encodings.UTF8)
should be
GrdSucu.Heading(I-1)= DefineEncoding(data.IdxField(I).StringValue, Encodings.UTF8)
or the API 2 equivalent
Tks a lot norman this line is same ?
GrdSucu.Cell(GrdSucu.LastIndex, M) = data.IdxField(M+1).StringValue.DefineEncoding(Encodings.UTF8)
seems like it should be
I tend to not use the dotted notation like you are
tks i try but dont work
GrdSucu.Cell(GrdSucu.LastIndex, M)= DefineEncoding(data.IdxField(M+1).StringValue, Encodings.UTF8)
debug crash when pick up special character
which suggests your data is NOT utf-8
define encoding only raise an exception when the data is NOT the encoding you say it is
nice i will tray other encoding tks norman for help me
Modern_Spanish_CI_AS should be a collation not an encoding. Your data should be (if I remember well) windows-1252.
So define the string as windows-1252 encoding and then convert to UTF8
Tks Antonio i will try that and coment
Antonio and Norman tks finally i solve like antonio sugest
[code]CadWin = DefineEncoding(data.IdxField(M+1).StringValue, Encodings.WindowsLatin5 )
GrdSucu.Cell(GrdSucu.LastIndex, M) =ConvertEncoding(CadWin, Encodings.UTF8)[/code]