zimso has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

please maybe someone can help me :

- I have a DB2 database which is in codeset UTF-8 and codepage 1208

- I have a field "lastname" which has some names which contain east european special character (š and á // s with caron or a with acute)

- my environment on the shell is LANG=de_DE.utf8

- I read the DB field with DBI module into Perl and want to convert the name to latex format for printing, but it doesn't work for the "s with caron"

á (a with a acute) (Unicode-Nummer: U+00E1 HTML-Code: á) ---->wanted goal: Latex format \'{a}

š (s with caron) (Unicode-Nummer: U+0161 HTML-Code: š) ---->wanted goal: Latex format \v{s}

I don't manage to convert the "s" character:

$tmp has ' áš'

I try a print TeX::Encode::encode('latex',$tmp); It gives : \'a?

\'a is correct "?" for the "š" is not

When I directly save the field to a file and look with a hexeditor on it it says: "e1 1a"

e1 is correct "1a" isn't (according to latin-2 it should be "b9")

Hmmm... Can someone please help me to manage to bring these east european names from a utf8 db to a universal latex format for printing ?

Many Many Thanks !!!!!!

Tina

  • Comment on Perl: How to convert db2 utf8 czech special character to latex format

Replies are listed 'Best First'.
Re: Perl: How to convert db2 utf8 czech special character to latex format (updated)
by haukex (Archbishop) on Sep 28, 2016 at 15:02 UTC

    Hi zimso,

    Could you show the output of use Devel::Peek; Dump($lastname); ? (Where $lastname is the variable holding the string in question)

    Update: TeX::Encode::charmap does appear to contain a mapping chr(0x0161) => "\\vs", # š.

    Regards,
    -- Hauke D

Re: Perl: How to convert db2 utf8 czech special character to latex format
by Laurent_R (Canon) on Sep 28, 2016 at 17:10 UTC