[Resolvido] Como inserir dados no banco com UTF8
Galera,
Estou utilizando ASP com conexão ao MySql.
Quando utilizo o comando insert ele insere os dados, mas vem como caracteres diferentes do esperado.
Exemplo: Mário = Mário
No select funciona normal, mas no insert é que ocorre esse problema. Segue os códigos:
conn.asp
<%
dim objcon, objrs
set objcon = server.createobject ("adodb.connection")
objcon.open "driver=MySQL ODBC 5.1 driver; server=localhost; uid=root; pwd=;database=db_brino; charset=utf8; option=3;"
%>
pedido.asp
<%@ codepage="1252" language="VBScript" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css/estilo.css" type="text/css" />
<title>Pedido</title>
</head>
<body><!--#include file="conn.asp"-->
<%If (Request.ServerVariables("REQUEST_METHOD") = "POST") then
SET rs = objcon.Execute("INSERT INTO pedido (nome_cli, end_cli, tel_cli) VALUES ('"&request.form("txtnome")&"', '"&request.form("txtend")&"', '"&request.form("txttel")&"')")
Response.Redirect "escolha.asp"
End If
%>
<form name="pedido" method="post" action="pedido.asp">
<p><b>Nome:</b></p>
<p><input type="text" size="50" name= "txtnome"/></p>
<p><b>Endereço:</b></p>
<p><input type="text" size="50" name= "txtend"/></p>
<p><b>Telefone:</b></p>
<p><input type="text" size="5" maxlength="8" name= "txttel"/></p>
<p><br><br></p>
<p><input type="submit" value=" Pedido "/></p>
</body>
</html>Discussão (6)
Carregando comentários...