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
  • 39,644
  • 15
  • 91
  • 133
vishal
  • 1,278
  • 2
  • 14
  • 33
  • 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,285
  • 20
  • 15
1

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

imaginabit
  • 359
  • 2
  • 7