2

In districts table I have a row as

district_id   district_name   country_id
15            Šahty           16       

While selecting from php and displaying in browser,it shows like this :�ahty

I am using mssql 2005 with collation SQL_Latin1_General_CP1_CI_AS.

The problem is something like this removing accent and special characters but i need the solution in php.

UPDATE(?): There is no support for UTF-8 in sqlserver. https://dba.stackexchange.com/questions/7346/mssql-2005-2008-utf-8-collation-charset

Community
  • 1
  • 1
prayagupa
  • 30,204
  • 14
  • 155
  • 192

3 Answers3

1

Hi you need to consider correct HTML content type header

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Data may be selected correctly, but browser may be can not displayed them as you expected. You can play with this in firefox by Menu View -> Character encoding -> until you find correct one

rkosegi
  • 14,165
  • 5
  • 50
  • 83
0

Just remove the UTF8 charset and let the browser select the charset it will set to ISO-8859-1 that will work with accents in sql server

0

In order to make special characters work, a general rule is that all the components must be on the same encoding. This means that database, database connection (very often forgotten 'SET NAMES {charset}' call after connecting to database) and web page Content-type have to be all in the same character set.

If you ask data from latin1 database and have database connection also has latin1, make sure the page you display values at is also latin1.

It's recommended though to use UTF-8 instead of latin1 everywhere, so if possible I recommending changing charsets and data in your database all to UTF-8, as it's more compatible all-around and easier to handle.

kingmaple
  • 4,200
  • 5
  • 32
  • 44
  • So, there is no way to change charsets in sqlserver 2005 database to UTF-8. http://dba.stackexchange.com/questions/7346/mssql-2005-2008-utf-8-collation-charset – prayagupa Feb 15 '12 at 04:25