vishal
vishal

Reputation: 1506

How to insert/update accented special characters in laravel

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 ?

Upvotes: 2

Views: 2976

Answers (2)

imaginabit
imaginabit

Reputation: 429

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

Upvotes: 1

Jesús Amieiro
Jesús Amieiro

Reputation: 2483

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.

Upvotes: 1

Related Questions