1

I'm using CodeIgniter with the MSSQL driver ($db['default']['dbdriver']).

I'm connecting to a remote database. In the hostname i have the IP of the server. The database collation is SQL_Latin1_General_CP1_CI_AS.

The problem is that when I fetch the data, the Hebrew shows as question marks. I tried various combinations of charsets, iconv and mb conversions, but none seems to work.

I would think it's something in the connection string, but using the MSSQL driver there's not connection string. When I tried it with the ODBC driver it worked properly (the setup for the ODBC worked from my local machine but not from the server, which has the MSSQL extension installed, hence I'm using the MSSQL driver).

Any help will be appreciated.

I've switched to PDO and now sometimes I get:

Fatal error: Cannot access property started with '\0' in /var/www/clients/client1/web2/web/cliqa/ci/system/database/drivers/pdo/pdo_result.php on line 176

I supposed it happens when the connection fails. Sometimes it shows properly (but with question marks) and sometimes I get this error.

2 Answers 2

1

SOLUTION:

It was solved by a friend, and it had to do something with the configuration of the server:

cat /etc/freetds.conf

create a new instance

[annoyingRemoteHostSrv]
    host = IP_ADDRESS
    port = 1433 
    tds version = 8.0
    client charset = UTF-8

hope it helps anyone ;)

Sign up to request clarification or add additional context in comments.

Comments

0

Use Unicode data types if possible - nvarchar. So server collation doesn't affect your data regardless of source codepage.

3 Comments

doesn't seem to work. I want to avoid making changes to the database, but it also doesn't work for existing data of this type
Can you check that data is fetched normally using SSMS? Maybe data initially is not correctly stored in database. One should use Hebrew collation in database to correctly store hebrew data.
this is a website that I have not written. I'm convinced that the data isn't stored properly - it uses latin charset instead of utf8 or hebrew encoding. I'm rebuilding the entire site and since it's active, during the migration process i want to use the original database using remote connection, until it is moved completely. When i fetched the data from my windows machine (using sqlsrv) it was decoded properly. I'm looking for a workaround

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.