Jump to content

Recommended Posts

It looks like I am having a problem reading in the ' and " from a MS SQL database. I am assuming this is because they really are "smart/curly quotes" I have everything that I can think of set to use utf-8 but I am still getting errors thrown in my face.  I am new to this PHP thing and have not had any problems with mysql db's before, but I have to get my app to work with MS SQL until they get around to porting it over to mysql. Any suggestions would be greatly appriceated. Thanks.

 

 

Link to comment
https://forums.phpfreaks.com/topic/63239-mssql-charset-conversion-problem/
Share on other sites

sorry for the confusion.

when I use mssql_query the page is filled with the errors that I have pasted below.  I did some troubleshooting and I found that the mssql database has curly quotes (also known as smart quotes) instead of the normal quotes and those are what are being replaced with question marks.  I have tried using the utf8_encode or decode, but have found that the error is given in the actual query as opposed to when I try to actually use the returned data object.

 

Warning: mssql_query() [function.mssql-query]: WARNING! Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?'). (severity 16) in /var/www/tools/scripts/display_widget_script.php on line 32

 

please let me know if this is still unclear.

$result = mssql_query($qs) or die ( "Error in query: $query. " );

 

is the line of code that I am using. (Not very informative, I know.)

 

Then I go on to

 

$rows = mssql_num_rows($result);

and use a loop to cycle through the rows

$row = mssql_fetch_assoc($result);

 

Again. The problem seems to be that some of the characters in the mssql database are encoded as utf-8

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.