|
-
Feb 16th, 2004, 11:11 AM
#1
Thread Starter
Lively Member
Dataset does not store special characters
Hi !
(I use VB.NET)
I have a dataset that is populated manually through the data entered in a form, but special characters like (ñ, à, á, ï,etc,..) it seems are not stored in the dataset, simply are omitted. For example if you enter in a text field ‘Cañon’ the dataset shows ‘Caon’ when you retrieves the data from the dataset.
Somebody can explain me why this happens and how can I solve it?
Thank you,
Cesar
-
Feb 16th, 2004, 11:17 AM
#2
PowerPoster
Just a thought, may not work, but try HttpEncoding the string before it gets to the page.
strMyString = HttpUtility.HttpEncode(strMyString)
or something like that....
-
Feb 16th, 2004, 11:27 AM
#3
Thread Starter
Lively Member
Ok, but I don' t know where I have to write it.
The code in the page 1 that stores the data:
Code:
Sub myData()
Dim ds as new DataSet
Dim dt as new DataTable
dt.columns.add("Mail")
Dim row As DataRow
row = dt.NewRow
row.Item("Mail") = mail.Text
dt.Rows.Add(row)
ds.tables.add(dt)
Session("UserData") = ds
End Sub
The code in the page 2 that retrieves the data:
Code:
Dim UserDS As Data.DataSet = Session("UserData")
control.Text = UserDS.Tables(0).rows(0).Item("Mail")
-
Feb 16th, 2004, 03:24 PM
#4
PowerPoster
Try right here:
row.Item("Mail") = HtmlEncode(mail.Text)
Or right here:
control.Text = HtmlEncode(UserDS.Tables(0).rows(0).Item("Mail"))
-
Feb 17th, 2004, 03:49 AM
#5
Thread Starter
Lively Member
Thank you but this is not correct. It must have another solution
-
Feb 17th, 2004, 06:28 PM
#6
Thread Starter
Lively Member
Oh yes, I'm sorry, your code runs, I had something wrong. Anyway it has the same result, don' t store the special characters.
But I have seen that if I erase the (CODEPAGE="1252") from the <%@Page Language="VB" CODEPAGE="1252"%>, then store the special characters, but I need this 'codepage' in the page because the '.js' validations, if I erase this codepage the alert messages of the '.js' validations also omit the special characters like (ñ, Ñ, é, è, ï,...).
Do you know another solution?
Thank you,
Cesar
-
Feb 17th, 2004, 06:34 PM
#7
PowerPoster
Sorry, special characters are out of my area of comfort....lol.
That was the only thing I could think of.
Could you do a Response.Write(mail.Text) statement to be sure that the special characters are being brought back?
If they are, then maybe there is a setting of the dataset that will allow it?
Wish I could help more, I just don't know it.
-
Feb 18th, 2004, 03:54 AM
#8
Thread Starter
Lively Member
I have done one 'response.write..' and it does the same.
In fact aren' t special characters, are characters that are used in Spanish language and other occidental languages.
My main problem is the alert messages of the '.js' validations, a cause of that I need to put <%@ Page Language="VB" CODEPAGE="1252"%>, because If I don' t put this 'codepage' the alert messages don' t allow these characers (ñ, Ñ, é, è, ü,..) of the Spanish language. Without the (codepage="1252") the application runs normally with all the occidental characters included (ñ, Ñ, é, è, ü, etc..).
It doesn' t matter if you don' t know this subject, anyway thank you for your aid !
Cesar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|