Accented vb strings in asp

Discussion in 'ASP General' started by Pedro Silva, Apr 15, 2004.

  1. Pedro Silva

    Pedro Silva Guest

    Hi,

    I'm trying to send an e-mail message from a VB variable, which
    contains accented characters, like this:

    dim str = "Acentuação" ' this string contains a c-cedilla and an
    a-tilde
    dim objMail As New MailMessage()
    objMail.Body = str
    [...] 'all other objMail property settings follow

    The message is delivered OK, but all the accented characters appear as
    2 characters. The str string above would show like 'Acentuação'.

    I know this is due to all VB variables being unicode and text e-mail
    not supporting it, but I'd already tried all possible encodings and it
    didn't help.

    Now I'm noticing that the same thing happens when I write an accented
    vb string to my database.

    I'd greatly appreciate any help.

    Thanx,

    Paulo
     
    Pedro Silva, Apr 15, 2004
    #1
    1. Advertising

  2. Pedro Silva

    Mark Schupp Guest

    What DBMS?
    How are you entering the problem string (html form, direct db update,...)?

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Pedro Silva" <> wrote in message
    news:...
    > Hi,
    >
    > I'm trying to send an e-mail message from a VB variable, which
    > contains accented characters, like this:
    >
    > dim str = "Acentuação" ' this string contains a c-cedilla and an
    > a-tilde
    > dim objMail As New MailMessage()
    > objMail.Body = str
    > [...] 'all other objMail property settings follow
    >
    > The message is delivered OK, but all the accented characters appear as
    > 2 characters. The str string above would show like 'Acentuação'.
    >
    > I know this is due to all VB variables being unicode and text e-mail
    > not supporting it, but I'd already tried all possible encodings and it
    > didn't help.
    >
    > Now I'm noticing that the same thing happens when I write an accented
    > vb string to my database.
    >
    > I'd greatly appreciate any help.
    >
    > Thanx,
    >
    > Paulo
     
    Mark Schupp, Apr 15, 2004
    #2
    1. Advertising

  3. Pedro Silva

    Pedro Silva Guest

    Hi Mark,

    I'm using MS SQL SERVER 7.

    The interesting thing is that when the data comes from in inpu filed
    (html form), it works ok (the accents are preserved in the database).
    But When I do something like:

    dim str as string = "Acentuação"
    dim sqlstr as string = "UPDATE MyDB SET aField = " + str + "WHERE
    keyField = 'KeyValue'"

    and run this SQL statement, I get 'Acentuação' in the database
    field.

    I can't change the database collation, and I don't think it's a good
    idea to change the filed type to unicode char, because then when it
    comes from the form fileds it wouldn't work (or would it?)

    Thanx for your help.

    "Mark Schupp" <> wrote in message news:<uGLE$>...
    > What DBMS?
    > How are you entering the problem string (html form, direct db update,...)?
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > www.ielearning.com
    >
    >
    > "Pedro Silva" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I'm trying to send an e-mail message from a VB variable, which
    > > contains accented characters, like this:
    > >
    > > dim str = "Acentuação" ' this string contains a c-cedilla and an
    > > a-tilde
    > > dim objMail As New MailMessage()
    > > objMail.Body = str
    > > [...] 'all other objMail property settings follow
    > >
    > > The message is delivered OK, but all the accented characters appear as
    > > 2 characters. The str string above would show like 'Acentuação'.
    > >
    > > I know this is due to all VB variables being unicode and text e-mail
    > > not supporting it, but I'd already tried all possible encodings and it
    > > didn't help.
    > >
    > > Now I'm noticing that the same thing happens when I write an accented
    > > vb string to my database.
    > >
    > > I'd greatly appreciate any help.
    > >
    > > Thanx,
    > >
    > > Paulo
     
    Pedro Silva, Apr 17, 2004
    #3
  4. Mark

    I finally figured out (took me 1 week of research and hard work) that all I had to do was add a culture=pt-BR in my web.config. In my research I naturally delt with internalization and localization issues, but it seemed too complicated, and I didn't see my application as international anyway (it only runs on one language). But in the end it seems that if you use any non-English characters in your code you'd better use this culture option

    Thanks for your help

    Paulo
     
    Paulo Góes, Apr 18, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mickey Segal

    Text search with accented characters

    Mickey Segal, Dec 15, 2005, in forum: Java
    Replies:
    3
    Views:
    809
    Roedy Green
    Dec 16, 2005
  2. Davide Benini

    accented characters

    Davide Benini, Jun 1, 2005, in forum: XML
    Replies:
    4
    Views:
    832
    David Carlisle
    Jun 1, 2005
  3. Phil Slater
    Replies:
    8
    Views:
    1,111
    Howard
    May 17, 2004
  4. Ben

    Strings, Strings and Damned Strings

    Ben, Jun 22, 2006, in forum: C Programming
    Replies:
    14
    Views:
    797
    Malcolm
    Jun 24, 2006
  5. charvind

    Accented charcters in Asp.net

    charvind, Aug 13, 2008, in forum: .NET
    Replies:
    0
    Views:
    474
    charvind
    Aug 13, 2008
Loading...

Share This Page