Florian Doyen
Florian Doyen

Reputation: 160

Convert French_CI_AS (ASCII) to UTF8

I would like to convert data from SQL Server (ASCII) to UTF-8.

When I use the query :

SELECT SERVERPROPERTY('Collation')

The result is 'French_CI_AS' (So, ASCII)

When I use DBAL from Symfony to get users from a remote database, and then, show them, it appears that the accents looks like that :

Ang�lina

I tried :

utf8_encode($value)

but it's only for ISO-8859-1...

So I tried :

iconv("French_CI_AS", "UTF-8", $value)

Or :

iconv("ASCII", "UTF-8", $value)

but it doesn't seems to work...

My meta template is :

<meta charset="utf-8" />

So, any idea to convert the user names from ASCII to UTF-8 ?

Upvotes: 2

Views: 4317

Answers (1)

&#193;lvaro Gonz&#225;lez
&#193;lvaro Gonz&#225;lez

Reputation: 146540

ASCII cannot store French, as far as I know. MSDN suggests that French_CI_AS uses Windows-1252 as encoding. Try that instead.

In any case, your DB library should take care of that automatically. You've probably failed to provide the connection encoding.

Upvotes: 2

Related Questions