Professional Web Applications Themes

Probelm with Unicode and ODBC-Drivers - PERL Modules

Hi Folks, I've a problem with Unicode and ODBC. I'm using Perl 5.8.4 Build 810 under Win32 and a Postgres-ODBC-Driver. When data like "" (the german signs) or the "" stored into the database via ODBC, it will be stored as utf8. How to disable this, so that data will be stored as Ascii ?? Thanks Pit...

  1. #1

    Default Probelm with Unicode and ODBC-Drivers

    Hi Folks,

    I've a problem with Unicode and ODBC.
    I'm using Perl 5.8.4 Build 810 under Win32 and a Postgres-ODBC-Driver.
    When data like "" (the german signs) or the "" stored into the
    database via ODBC, it will be stored as utf8.

    How to disable this, so that data will be stored as Ascii ??

    Thanks Pit


    Pit Guest

  2. #2

    Default Re: Probelm with Unicode and ODBC-Drivers

    "Pit" <pharrendorfam-soft.de> writes:
    > Hi Folks,
    >
    > I've a problem with Unicode and ODBC.
    > I'm using Perl 5.8.4 Build 810 under Win32 and a Postgres-ODBC-Driver.
    > When data like "" (the german signs) or the "" stored into the
    > database via ODBC, it will be stored as utf8.
    >
    > How to disable this, so that data will be stored as Ascii ??
    You probably mean latin1 or iso-8859-1 rather than ascii.

    It seems like your data has the utf8 flag turned on and the XS code
    cannot handle the data correctly. To be sure, just check your strings
    using the Dump() function from the Devel::Peek module. If this is the
    case, then you can force the strings to iso-8859-1 by using the
    encode() function in the Encode module.

    Regards,
    Slaven

    --
    Slaven Rezic - slaven <at> rezic <dot> de

    Tk-AppMaster: a perl/Tk module launcher designed for handhelds
    [url]http://tk-appmaster.sf.net[/url]
    Slaven Rezic Guest

  3. #3

    Default Re: Probelm with Unicode and ODBC-Drivers

    On Tue, 8 Mar 2005, Pit wrote:
    > I've a problem with Unicode and ODBC.
    > I'm using Perl 5.8.4 Build 810 under Win32 and a Postgres-ODBC-Driver.
    > When data like "" (the german signs) or the "" stored into the
    > database via ODBC, it will be stored as utf8.
    >
    > How to disable this, so that data will be stored as Ascii ??
    "Ascii" doesn't contain these characters, so you certainly cannot
    "store them as" Ascii.

    Were you looking for an 8-bit Latin-1 character encoding, maybe
    iso-8859-1 or Windows-1252?

    I think we need to know more about your environment: I don't believe
    that Perl 5.8.4 would go using utf8 encoding unless it had been given
    a reason to do so. But even if it has, you can apply encoding at
    appropriate points to get it to do what you intended.

    As always, some kind of minimal test harness which the hon, Usenauts
    can run themselves and which demonstrates the effect you're
    complaining about, can be better than a thousand words of woffle
    around the topic.
    Alan J. Flavell Guest

  4. #4

    Default Re: Probelm with Unicode and ODBC-Drivers

    to perl 5.8.4: I think, Perl 5.8.4 using utf8 encoding every time (use utf8
    is no longer necessarily)

    I'm using a Perl/Tk-Script, enter data in an Entry-widget and store this
    data via ODBC-Driver into a database-table. before data will be stored,
    they are converted into Windows-1252. after the sql-input-statement the
    data are in the utf8-Format again.

    can be a problem of the PerlIO-Layer ???

    Thanks
    Pit




    Pit Guest

  5. #5

    Default Re: Probelm with Unicode and ODBC-Drivers

    On Wed, 9 Mar 2005, Pit blurted out:
    > to perl 5.8.4: I think, Perl 5.8.4 using utf8 encoding every time
    Only if it's provoked into doing so:

    | The principle is that Perl tries to keep its data as eight-bit bytes
    | for as long as possible, but as soon as Unicodeness cannot be
    | avoided, the data is transparently upgraded to Unicode.
    > (use utf8 is no longer necessarily)
    Because, as the doentation told you:

    | the ``Unicodeness'' is now carried with the data, instead of being
    | attached to the operations.
    > I'm using a Perl/Tk-Script, enter data in an Entry-widget and store
    > this data via ODBC-Driver into a database-table. before data will be
    > stored, they are converted into Windows-1252. after the
    > sql-input-statement the data are in the utf8-Format again.
    As always, some kind of minimal test harness which the hon. Usenauts
    can run themselves and which demonstrates the effect you're
    complaining about, can be better than a thousand words of woffle
    around the topic.

    If you are certain that the data you got from the input widget is in
    windows-1252, then the input widget is not part of the problem and
    does not need to be included in the test case. I'd recommend putting
    just enough in your test harness to show the data being stored, up to
    the point where you can demonstrate that it's in utf8 format.

    Until then, it seems to me, we are only making wild guesses.

    Maybe some code is designed to be sensitive to the locale setting, and
    maybe you have utf-8 in your locale, so the code thinks you want to
    get your data in utf8 format? Let's see some code.
    > can be a problem of the PerlIO-Layer ???
    What's that supposed to mean?

    I've just had a thought. If you are using windows-1252 characters
    which are not in the iso-8859-1 repertoire (for example smart quotes,
    trademark sign, etc.), then their corresponding Unicode code points
    are outside of the 8-bit range, and maybe they are being represented
    in utf8. But without any code nor any real data, one can only guess.
    Alan J. Flavell Guest

  6. #6

    Default Re: Probelm with Unicode and ODBC-Drivers

    thanks for your efforts, we have solved our problem

    pit



    Pit Guest

  7. #7

    Default Re: Probelm with Unicode and ODBC-Drivers

    On Thu, 10 Mar 2005, Pit wrote:
    > thanks for your efforts, we have solved our problem
    But you're not going to re-pay the favour by explaining where
    the problem was found?
    Alan J. Flavell Guest

  8. #8

    Default Re: Probelm with Unicode and ODBC-Drivers

    we solved the problem as follows.

    we overwrite the functions _fetch, _prepare and _do of the
    DBD::ODBC-Module and make some character-conversions with the
    encode-function in Module Encode

    Pit



    Pit Guest

Similar Threads

  1. ODBC Drivers error '80004005'
    By xwardox in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: November 1st, 07:39 PM
  2. Updating mysql ODBC drivers in CF
    By ChuckInAtl in forum Coldfusion Database Access
    Replies: 2
    Last Post: June 29th, 10:39 PM
  3. MySQL ODBC/OLE DB Drivers
    By CJM in forum ASP Database
    Replies: 4
    Last Post: February 23rd, 09:53 PM
  4. Which ODBC drivers
    By malcolm.iiug in forum Informix
    Replies: 2
    Last Post: November 4th, 11:33 AM
  5. Level 2 ODBC Drivers for IDS
    By David E. Grove in forum Informix
    Replies: 3
    Last Post: July 22nd, 05:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139