# PHP Problem with entering non-unicode characters into SQL Server

**URL:** <https://www.phphelp.com/t/php-problem-with-entering-non-unicode-characters-into-sql-server/26755>\
**Category:** General Database (Oracle, SQL Server, etc)\
**Created:** [July 23, 2018, 2:30pm UTC](https://www.phphelp.com/t/php-problem-with-entering-non-unicode-characters-into-sql-server/26755 "2018-07-23T14:30:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aravil1](https://www.phphelp.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@Aravil1](https://www.phphelp.com/u/Aravil1)\
**Post date:** [July 23, 2018, 2:30pm UTC](https://www.phphelp.com/t/php-problem-with-entering-non-unicode-characters-into-sql-server/26755/1 "2018-07-23T14:30:34Z")

</div>

Good evening,

When I try to enter Polish characters (like ę, ą, ó and so on) into SQL Server via PHP, I get “strange” characters insterted instead of correct ones. Column is NVARCHAR and collation is POLISH\_CI\_AS and both html (form) and php file are saved in UTF-8. Creating a statement INSERT INTO TableName VALUES (N’$value’); does not help. When I insert data directly via SSMS, everything works properly

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [July 23, 2018, 2:37pm UTC](https://www.phphelp.com/t/php-problem-with-entering-non-unicode-characters-into-sql-server/26755/2 "2018-07-23T14:37:06Z")

</div>

I’d print the complete SQL statement out and see what it passed to the database. From there you can see where the issue is, and correct.

---

<div class="post-metadata">

**Author:** ![ErnieAlex](https://www.phphelp.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@ErnieAlex](https://www.phphelp.com/u/ErnieAlex)\
**Post date:** [July 23, 2018, 6:25pm UTC](https://www.phphelp.com/t/php-problem-with-entering-non-unicode-characters-into-sql-server/26755/3 "2018-07-23T18:25:08Z")

</div>

I was reading about this problem awhile ago. I found that there are several issues with it. The data in the database needs to be inserted as UTF8 values and also, you need to tell the browser to display, them too.  
This link talks about solutions near the bottom. Might help you out… [SitePoint-Polish-Chars](https://www.sitepoint.com/forums/showthread.php?565983-Polish-characters-on-site)
