Accented vb strings in asp

P

Pedro Silva

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
 
M

Mark Schupp

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

Pedro Silva

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 said:
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 said:
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
 
P

Paulo Góes

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top