Inserting special character data into SQL SERVER

Asked

Viewed 61 times

1

I’m having trouble making a registration, do the correct data insertion, however I’m having problems with special characters even having defined

<meta charset="UTF-8">

In pure php

header('Content-Type: text/html; charset=utf-8');
echo '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">';//ISSO FOI UMA MEDIDA DE DESESPERO PARA TENTAR CORRIGIR

When saving by the ide I left Formatting as UFT-8 as well

I am using SGDB Sql Server 2016 Enterprise

excerpt from the data entry code

<?php
include('global.php');
header('Content-Type: text/html; charset=utf-8');
echo '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">';
co();
if(isset($_POST["EventON"]))
{
    if(VerificaEquipe() < 5) die("Sem permissão");
    $idevento = $_POST["idevento"];
    $titulo = $_POST["titulo"];
    $descricao = $_POST["desc"];
    $descitens = $_POST["itens"];
    $tipoevento = $_POST["typeevent"];
    $inicio = date('Y-m-d H:i:s', time());
    $fim = $_POST["end"];
    $itensview = $_POST["isvisible"];
    if(empty($idevento) || empty($titulo) || empty($descricao) || empty($descitens) || empty($fim))
    {
        echo '<script type="text/javascript">alert("Todos os campos devem ser preenchidos corretamente.");window.location="";</script>';
    }
    else
    {
        odbc_exec($conn1, "INSERT [{$dataBaseTank}].[dbo].[Active] ([ActiveID], [Title], [Description], [Content], [AwardContent], [HasKey], [StartDate], [EndDate], [IsOnly], [Type], [ActionTimeContent], [IsAdvance], [GoodsExchangeTypes], [GoodsExchangeNum], [limitType], [limitValue], [IsShow], [ActiveType], [IconID]) VALUES ($idevento, N'$titulo', N'$descricao', N'$descricao', N'$descitens', $tipoevento, N'$inicio', N'$fim', 0, 0, NULL, 0, NULL, NULL, NULL, NULL, $itensview, 0, 0)");
        echo '<script type="text/javascript">alert("Evento Adicionado com sucesso, agora adicione os itens e não se esqueça de atualizar a xml na request!");window.location="?page=eventitens";</script>';        
    }
}
qc();
?>

After inserting data into sql server

inserir a descrição da imagem aqui

  • 2
  • Take a look at the charset set set in your SQL Server database, in the database properties.

  • the collation defined is Chinese_prc_ci_as, but n da para modificar is giving error

No answers

Browser other questions tagged

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