Topic
10 replies Latest Post - ‏2007-07-10T06:18:41Z by Host
Host
Host
7 Posts
ACCEPTED ANSWER

Pinned topic German Umlaute

‏2007-06-08T09:11:53Z |
I am using PHP to read files from the iSeries.

==================
// Lesen von AS/400
$result=odbc_exec($source,"Select * from ECOLIB.ECP330");

// Feld entnehmen
$Bezeichnung=odbc_result($result,2);
===================

If the the field read contains a german umlaut the variable $Bezeichnung will look fine up to the character before the umlaut, the rest is garbage.

We use Suse Linux Enterprise 9.
The locale codeset is UTF-8 (ccsid 1208).

Obviously something is wrong.
Does anybody know the screw I have to turn?
Updated on 2007-07-10T06:18:41Z at 2007-07-10T06:18:41Z by Host
  • SystemAdmin
    SystemAdmin
    262 Posts
    ACCEPTED ANSWER

    Re: German Umlaute

    ‏2007-06-08T22:47:22Z  in response to Host
    Hi,

    Can you tell us wich ccsid do you have in the database field / host column data?

    273 (0x111) may be?

    If this is the case, you may need to setup the environment where the PHP script process is being run under the same locale. This is:

    1. export LANG=de_DE
    2. php -f myscript.php

    Or either from the same PHP script with:

    http://us.php.net/setlocale

    Note that is not the same as "de_DE.utf8" or "de_DE.UTF-8", you must specify just "de_DE"

    Try that and let us know if you still have the problem. That the case it will be helpfull if you can attach here the cwbtrc, cwbmedic and sql.log, let me know if you need more detailed instructions about how to use these tools included with the iSeriesAccess for Linux RPM

    Regards
    • Host
      Host
      7 Posts
      ACCEPTED ANSWER

      Re: German Umlaute

      ‏2007-06-14T14:10:58Z  in response to SystemAdmin
      > Hi,
      >
      > Can you tell us wich ccsid do you have in the
      > database field / host column data?
      >
      > 273 (0x111) may be?

      Yes
      > Note that is not the same as "de_DE.utf8" or
      > "de_DE.UTF-8", you must specify just "de_DE"

      I added
      setlocale(LC_ALL,"de_DE");
      to my code.

      > Try that and let us know if you still have the
      > problem.

      Still have the problem.

      cwbtrc with details is somewhat longish...

      There are lines like "NL CONV:CONV NOT FOUND scp=819 tcp=500 siso=1 pad=4" in it.
      Is there my problem?

      Updated on 2007-06-14T14:10:58Z at 2007-06-14T14:10:58Z by Host
      • Host
        Host
        7 Posts
        ACCEPTED ANSWER

        Re: German Umlaute

        ‏2007-06-15T08:07:13Z  in response to Host
        Hohum, maybe I found the problem.
        Now I need a pointer to the solution...
        I have a local (linux) ccsid of 1208 and a remote (iSeries) ccsid of 273.
        I should have a conversion table in /opt/ibm/iSeriesAccess/conv_tables named 011104B8.tbl

        I tried to download this table with /opt/ibm/iSeriesAccess/bin/cwbnltbl 273 1208

        The table is still missing.
        How do I get this table?
        • SystemAdmin
          SystemAdmin
          262 Posts
          ACCEPTED ANSWER

          Re: German Umlaute

          ‏2007-06-15T14:04:44Z  in response to Host
          Yes, indeed that what I think is the problem, and that's why I recommended you to set the PHP process locale to 273 using setlocale(). But if you say is not working even with the proper locale set, then may be is other problem.

          can you execute this command:

          1. locale -a | grep de_DE

          I want to be sure you have the proper locale support for de_DE, otherwise that's why the call to setlocale() is failing.

          You say you have tried downloading the conversion table, however AFAIK, is probable that conversions are not that straightforward, so intermediate steps could be happening. ( 273 -> 13488 -> 1208 ), so not having a direct table from 273 to 1208 may not be the issue.

          Have you already tried starting your whole Linux session in de_DE?

          Have you already tried this?:

          1. export LANG="de_DE"
          2. php -f myscript.php

          How do you test that fetched data has "garbage" after umlaut? Did you just tried outputting? or did you write it to a file and then tried openning? If so, are you sure the output device ( text editor, web explorer etc ) has the correct locale to display such data?

          Once again, just a friendly reminder, don't use de_DE.utf8 or de_DE.UTF-8, just de_DE

          Regards
          • Host
            Host
            7 Posts
            ACCEPTED ANSWER

            Re: German Umlaute

            ‏2007-06-20T13:50:52Z  in response to SystemAdmin
            Okay, back at my workplace...

            My locales:
            1. locale -a |grep de_DE
            de_DE
            de_DE.utf8
            de_DE@euro

            Setting the LANG explicitly with (# export LANG="de_DE") doesn´t change anything.

            I am outputting the fetched data with print($Bezeichnung."\n");
            The string will be displayed up to the umlaut correctly, then it becomes elvish:
            "TL StraC;LC9`j 2$p¬2<FAME=H=."
            It should be "TL Straßburg".

            I use the SSH Tectia Client to connect to the Linux server.
            • Host
              Host
              7 Posts
              ACCEPTED ANSWER

              Re: German Umlaute

              ‏2007-07-04T07:15:24Z  in response to Host
              I looked up the available conversion tables in /opt/ibm/iSeriesAccess/conv_tables and I am missing the files 011104b8.tbl (iSeries ==> Linux) and 04b80111.tbl (Linux ==> iSeries).

              The cwbnltbl utility obviously doesnt work, so can I download those two files directly from somewhere?
              • SystemAdmin
                SystemAdmin
                262 Posts
                ACCEPTED ANSWER

                Re: German Umlaute

                ‏2007-07-05T15:34:15Z  in response to Host
                As I noted in a previous post, converting data is not necessary straightforward, so not having that conversion tables do not mean is not working. cwbnltbl will tell you if you need such a table or not.

                Can you upload here ODBC trace sql.log ?

                To learn how to enable sql.log check this

                http://www.easysoft.com/developer/interfaces/odbc/linux.html
                • Host
                  Host
                  7 Posts
                  ACCEPTED ANSWER

                  Re: German Umlaute

                  ‏2007-07-06T08:52:21Z  in response to SystemAdmin

                  ===
                  1. /opt/ibm/iSeriesAccess/bin/cwbnltbl 273 1208

                  cwbnltbl - Download conversion table utility
                  Using system: AS-SCHARR
                  Support for conversions from 273 to 1208 ready.
                  ===

                  Doesnt change anything.

                  Attachments

                  Updated on 2007-07-06T08:52:21Z at 2007-07-06T08:52:21Z by Host
              • SystemAdmin
                SystemAdmin
                262 Posts
                ACCEPTED ANSWER

                Re: German Umlaute

                ‏2007-07-06T15:31:52Z  in response to Host

                As stated before, the product uses BOTH conversion tables AND iConv for character conversions. Current ALL unicode conversions are forced to go through iConv, therefore the cwbnltbl function is working perfectly when stating that the conversion to unicode is working (as its just verifying that iConv can handle it.)
                • Host
                  Host
                  7 Posts
                  ACCEPTED ANSWER

                  Re: German Umlaute

                  ‏2007-07-10T06:18:41Z  in response to SystemAdmin
                  So the problem could be missing tables from iconv?

                  How do I check the needed tables?
                  I need a conversion from ccsid 273 to ccsid 1208.