Results 1 to 8 of 8

Thread: Dataset does not store special characters

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Location
    Barcelona
    Posts
    70

    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

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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....

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Location
    Barcelona
    Posts
    70
    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")

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Try right here:

    row.Item("Mail") = HtmlEncode(mail.Text)

    Or right here:
    control.Text = HtmlEncode(UserDS.Tables(0).rows(0).Item("Mail"))

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Location
    Barcelona
    Posts
    70
    Thank you but this is not correct. It must have another solution

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Location
    Barcelona
    Posts
    70
    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

  7. #7
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Location
    Barcelona
    Posts
    70
    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
  •  



Click Here to Expand Forum to Full Width