Encoding ASP Classic

Asked

Viewed 5,074 times

1

I have an application in .asp and was having problems with special characters, they were printed on canvas in a totally unnatural way.

To solve the problem, I applied:

Response.CharSet = "ISO-8859-1"
Response.CodePage = 28591

But now they are being printed on screen as.

Note: In my application, there is a mixture of .asp and .aspx

  • Your database is UTF8?

  • @Guilhermenascimento Forgive me the question, but how can I verify it ?

  • Did you make the bank or was someone else is Sqlserver2008? Is there any way to view the structure? Or do you not use bank?

  • @Guilhermenascimento was someone else but I have access to SA

  • These characters are printed from a view populated by a bank or is something written manually in the file . aspx?

  • @Guilhermenascimento Both

  • You saved the files as utf8 or as ansi?

Show 2 more comments

2 answers

3


Always encode in UTF-8 never in ANSI.

ASP Classic code:

Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
Response.CodePage = 65001
Response.CharSet = "UTF-8

If you want the HTML code it would be:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

Because in UTF-8? Because it’s much more natural to write the word like this "ação" than "a&ccedil;&atilde;o" Besides being the recommended way to language with accents.


Sometimes don’t just put the above code if the file header encoding is like ANSI, so do it:

Open the file . ASP in the notepad. Send "save as..." and set utf-8

inserir a descrição da imagem aqui

1

When I look at ASP pages I check two things: the script formatting (page .Asp - if you have ANSI, UTF...) and the script encoding (Response.charset). Use for both UTF-8 configurations.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.