MS SQL Connection, UTF8 problems?

Hello @all,

do you also have problems with UTF-8 charset to mssql? I am using PDO driver, and if I am connecting with scriptcase to the database and select some fields in grid with “ä,ö” or something else, it does not work. If I connect in a blank app and connect to myself to the database and select some fields, it works… I think there is a problem with the driversettings…

Does someone has the same problem?

The support did not answer since 20 days… Are there some problems at scriptcase team?

regards,

erik

edit
here is my code, which is working:

$dsn = “sqlsrv:Server=server3,1433;Database=db”;
$conn = new PDO($dsn, “user”, “pwd”);
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = “SELECT nachname, zeitraum_fg FROM sharepoint_aktuelle_einsaetze WHERE id = 1”;
foreach ($conn->query($sql) as $row) {
print_r($row);
}

result:
Array ( [nachname] => Schönherr [0] => Schönherr [zeitraum_fg] => [1] => )

Here is code using default connection from scriptcase:

$check_sql = ‘SELECT nachname FROM sharepoint_aktuelle_einsaetze WHERE id = 1’;
sc_lookup(rs, $check_sql);

if(isset({rs[0][0]}))
{
$nachname = {rs[0][0]};
}
else
{
//
}
echo $nachname;

Result:
Sch�nherr

You are right. Check this out:

  1. PHP setting
    image
  2. MariaDb settings (2)
    image
    image
  3. MariaDb SQL Tool (DbForge Fusion) connection settings
    image
  4. Scriptcase project settings
  5. Application settings
  6. Display in Scriptcase
  7. Display in DbForge Fusion

So where is the problem ? Can Scriptcase team help us with that ?

2 Likes

I am waiting since 3 months, support does not answer. Last answer one month ago…

@jefch do you hvae some updates?

Hi @ny_unity
No answer at all. I had another issue like this in Chart Application and support old me it was solved in the 9.5 release. But I haven’t updated yet … waiting a few more weeks for the majority of bugs to be fixed.

I updates already… unfortunaly, the charset problem is still there :frowning:

Try to

  • create a new DB from scratch with UTF-8 settings
  • create one table and watch the charset and collation (see below)
  • set up PHP
  • create a new SC App with a project set up with UTF-8
    I’m sure this will be OK.
    What I noticed with SC is that some settings stay “somewhere” and that recreate an App from scratch usually solves the issue.
    Good luck.
    image

Bonjour j’ai exactement le même problème qui est arrivé il m’affiche des � sur chaque caractère, je ne sais pas comment gérer ce problème.
Si vous êtes Français pouvez vous me contacter au 0320571524
Merci d’avance.

image Capture

I got these answert today for this issue:

Good day Joerg

So it has come to our attention that there is an issue with UTF8. We have registered a bug and have escalated it to our developers. it is not only affecting Ms Sql but MySql and PostgreSQL as well.

Please bear with us as we are working on resolving this issue.

Thank you for your patience.

Regards.

Andrew Daff

Support

I linked this forum thread in support ticket… we will watch it

I am still waiting for a solution, I have submitted a ticket to support for 30 days, which asks me to review the encoding of my databases !!
This is rubbish my projects have been running for 10 years without problem, I don’t have to redo everything the problem comes from one place in the scriptcase application. Still no return, it’s not normal

Hi dufour_francois.
I had the same issue as you are experiencing. What I explained above solved everything.
I backed up my db, recreated one set up correctly and restored the data. Worked well.

Hello jefch
This problem is new, above all it works even with
SQL Builder I have this problem and with all my sqlserver interbase mysql databases, this problem persists and I have no issues.

You can use one of these to patch the problem

SELECT convert(cast(yourfield as binary) using utf8) FROM

or

SELECT convert(cast(yourfield as binary) using latin1) FROM

Yes thanks or {myField} =utf8_encode ({myField});
But it’s stupid , it’s stupid it worked great before now the varchar is no longer well set while the database has not been modified, there is something in the scriptcase browser that is incorrectly set

Yes thanks or {myField} =utf8_encode ({myField});

it’s stupid it worked great before now the varchar is no longer well set while the database has not been modified, there is something in the scriptcase browser that is incorrectly set

I am using utf8mb4_unicode_ci in the database and Western (ISO8859-15) in SC for the french language without problem except for the calendar that only work with UTF8

I am experiencing some problems with pyodbc and an Oracle 11.2 Express databank. I cannot send unicode objects to fill the placeholders.

I first create the connection and the cursor:

con = pyodbc.connect(‘uid=oracleuser;driver={microsoft odbc for oracle};server=//localhost:1521/xe;pwd=xxx’)
cur = con.cursor()
Then I can perform some simple queries that work, like:

cur.execute(u’SELECT * FROM MY_TEST_TABLE’)
<pyodbc.Cursor object at 0x07C92988>

list(_)
[(‘pepe’, )]
Then some more complex ones with placeholders, that work as well:

cur.execute(‘SELECT * FROM MY_TEST_TABLE WHERE column1 = ?’, ‘lol’)
<pyodbc.Cursor object at 0x07C92988>

list(_)
[] # No result as expected
But when I test the real case with unicode strings, I get the following problems:

cur.execute(‘SELECT * FROM MY_TEST_TABLE WHERE column1 = ?’, u’lol’)
Traceback (most recent call last):
File “”, line 1, in
Error: (‘HY004’, ‘[HY004] [Microsoft][ODBC Driver Manager] SQL data type out of range (0) (SQLBindParameter)’)
Funny, but if the main query is unicode, it works:

cur.execute(u’SELECT * FROM MY_TEST_TABLE WHERE column1 = ?’, ‘lol’)
<pyodbc.Cursor object at 0x07C92988>

list(_)
[]
This code worked well with SQLite and SQL Server, but it crashes with an Oracle 11.2 Express DB.

I ran the following SQL to check the encoding, and it is UTF8

SELECT * FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER = ‘NLS_CHARACTERSET’

AL32UTF8
Maybe the problem of SQL now has been sought out.