2

I am trying to insert / update accented special characters through Laravel

like

çã, á, é, í, ó, ú, ü, ñ

and many more.

But laravel is converting into some hex code and insert it into database. Which in return, i am getting content in chinese...

For example:- i am trying to this

enter image description here

Actual query runs in laravel

enter image description here

What shown in blade is

enter image description here

I am using SQL-Server-2008

Data type of column is nvarchar and collation is SQL_Latin1_General_CP1_CI_AI

So, what i have conclude is, this is the laravel issue becuase if run query directly in database by prefixing N like

set 'name' = N'Vishal çã, á, é, í, ó, ú, ü, ñ'

then it works fine.

How could we acheive this through laravel ?

miken32
  • 42,008
  • 16
  • 111
  • 154
vishal
  • 1,368
  • 2
  • 15
  • 34
  • Does this answer your question? [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – miken32 Mar 15 '20 at 20:03

2 Answers2

1

I write Laravel apps that are used with spanish characters (á,ñ,...). I use utf8_unicode_ci as default colation, utf8 as default characterset, utf8_unicode_ci as table collation and utf8_unicode_ci with utf8 as character set for the varchar columns. Try it.

Jesús Amieiro
  • 2,443
  • 21
  • 15
1

If you are using Spanish language better use utf8mu_spanish_ci in your conf/database.php

imaginabit
  • 409
  • 4
  • 9