Using accented characters

idextrus
2005-01-17
2012-12-04
  • idextrus
    idextrus
    2005-01-17

    Hello, this is further to the thread of French Accented Characters, but I now need a little help to get it working properly.

    I have the $diff array in place and am calling the characters by their name ($diff[233] etc.)

    The array that I am using is:
    $diff=array(
    196=>'Adieresis',
    228=>'adieresis',
    214=>'Odieresis',
    246=>'odieresis',
    220=>'Udieresis',
    252=>'udieresis',
    223=>'germandbls',
    224=>'agrave',
    225=>'aacute',
    232=>'egrave',
    233=>'eacute',
    236=>'igrave',
    237=>'iacute',
    242=>'ograve',
    243=>'oacute',
    249=>'ugrave',
    250=>'uacute',
    200=>'Egrave',
    241=>'ntilde'
    );
    and I am calling the elements like this:

    $pagetext="this is some text where I need an accented character. The word with the character is d".$diff[233]."cor.";

    This should print the word "dcor", but what gets printed to the pdf file is "deacutecor". How do I make this character print as ??

    Thanks

    Chris

     
    • Olipla
      Olipla
      2005-01-17

      Use the  directly!

       
      • idextrus
        idextrus
        2005-01-17

        I would love for that to work as that would be the easy way, but when I put:

        $pagetext="prsenter";

        it prints: prsenter

         
    • Olipla
      Olipla
      2005-01-17

      In theory you shouldn't need to use any diff array at all, because the default encoding (WinAnsiEncoding) is already correct for French. But I know there are some problems in this class with accented letters. If you don't want to bother with that, try FPDF.

       
    • idextrus
      idextrus
      2005-01-17

      I would really prefer not to switch classes at this point as I already have numerous pdf files that I am creating from a database, and I have a real good handle on everything else about this class. Have you not seen or been able to get french accented characters to work with this class?

      I am in a bit of a bind as the project that I am working on has a launch date of Feb 1 and I need to have the french characters working by then.

       
    • Olipla
      Olipla
      2005-01-17

      I just took the demo.php file, replaced "creation" by "cration" and it worked!

       
      • idextrus
        idextrus
        2005-01-17

        Very strange,

        Here is what I get if I replace PHP Pdf Creation with PHP Pdf Cration

        http://66.221.205.76/readme.php

        I wonder if it has something to do with the fonts that I have in the fonts folder. It is a Linux server with Red Hat

         
    • Olipla
      Olipla
      2005-01-17

      Try to put chr(233) to see what it gives.

       
    • Olipla
      Olipla
      2005-01-17

      You're typing your text on a Mac and of course you didn't say it!

       
      • idextrus
        idextrus
        2005-01-18

        You are correct olipla, I am typing on a Mac. I am using the text editor BBEdit. Do I have to specify different character encoding in the script then? I have never run into problems with typing on a Mac before with regard to accented characters. How do I fix it? Or, do you know how to type '' while in Pico? I can modify the file on the server to see if it accepts the raw .

        Thanks