UTF-8 Problems with Symfony on OpenEdge ODBC

Discussão em 'StackOverflow' iniciado por fdantas, Dezembro 15, 2020.

  1. fdantas

    fdantas Administrator Moderador

    i'am running a PHP website for a company with Symfony 4.4 (PHP 7.3, Ubuntu Server 18.04). To implement some new features i have to fetch data from a third party openedge database (progress, UTF-8) via odbc. Most of the data stored there is in czech language, so a lot of letters have diacritics. The odbc connection itself is working and gives me data. But all characters having diacritics dont work. To get data via php i use the symfony console (created a command which starts my php code). For the php code i followed the OpenEdge Knowledgebase (link).

    Example: The column i want to get via odbc contains: Věra

    My Code:

    $conn_id=odbc_connect("dsn_name","sysprogress","xxx", SQL_CUR_USE_ODBC);
    $sql = "select * from pub.table where id=1234";
    $cur = odbc_exec($conn_id, $sql);
    while(odbc_fetch_row($cur)){
    $string = odbc_result($cur, 9 ); //Věra
    }
    echo $string;


    The output is "Vra", the letter with diacritic is missing.

    What i also tried to find the source of the problem:

    1. Write the $string into a csv (Unix LF having UTF-8-BOM). Insert is "VSUBra"
    2. Write the string into own DB (postgres 10.3). Same Problem
    3. Tried lots of encodings like utf8_encode, utf8_decode, iconv, mb_convert_encoding.. Same Problem
    4. i created a new php-file, only having the code above and startet it with php -f test.php. The result: Věra

    To me it looks like the UTF-8 problem is with Symfony, cause without Symfony the data is displayed correctly.

    Can anyone help me to solve this problem?

    Greetings Heiko

    Continue reading...

Compartilhe esta Página