Professional Web Applications Themes

[PHP] HTML equivalents of accented characters - PHP Development

Hello, This is a reply to an e-mail that you wrote on Mon, 11 Aug 2003 at 19:18, lines prefixed by '>' were originally written by you. > I don't think this has been discussed, although I'm not really sure > what you would call these accented characters, so I haven't been able > to do a complete search of the archives, so apologies if this has been > previously discussed. > Is there a function that not only turns & into &, " into ", > and the like, but also turns into and likewise with other ...

  1. #1

    Default Re: [PHP] HTML equivalents of accented characters

    Hello,

    This is a reply to an e-mail that you wrote on Mon, 11 Aug 2003 at
    19:18, lines prefixed by '>' were originally written by you.
    > I don't think this has been discussed, although I'm not really
    sure
    > what you would call these accented characters, so I haven't been
    able
    > to do a complete search of the archives, so apologies if this has
    been
    > previously discussed.
    > Is there a function that not only turns & into &, " into ",
    > and the like, but also turns into and likewise with other
    > accented characters? I know I could easily write one, but why if
    one
    > already exists?
    echo htmlentities(""); // outputs é

    See [url]http://php.net/htmlentities[/url]

    David.

    --
    phpmachine :: The quick and easy to use service providing you with
    professionally developed PHP scripts :: [url]http://www.phpmachine.com/[/url]
    Free PHP error handling script: [url]www.phpmachine.com/error-handler/[/url]

    Professional Web Development by David Nicholson
    [url]http://www.djnicholson.com/[/url]

    QuizSender.com - How well do your friends actually know you?
    [url]http://www.quizsender.com/[/url]
    David Nicholson Guest

  2. #2

    Default Re: [PHP] HTML equivalents of accented characters

    [url]http://hotwired.lycos.com/webmonkey/reference/special_characters/[/url]
    should have all you want

    >From: "Liam Gibbs" <liamgibbssympatico.ca>
    >To: "php list" <php-generallists.php.net>
    >Subject: [PHP] HTML equivalents of accented characters
    >Date: Mon, 11 Aug 2003 14:18:37 -0400
    >
    >I don't think this has been discussed, although I'm not really sure what
    >you would call these accented characters, so I haven't been able to do a
    >complete search of the archives, so apologies if this has been previously
    >discussed.
    >
    >Is there a function that not only turns & into &amp;, " into &quot;, and
    >the like, but also turns into &eacute; and likewise with other accented
    >characters? I know I could easily write one, but why if one already exists?
    __________________________________________________ _______________
    Protect your PC - get McAfee.com VirusScan Online
    http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

    Didier McGillis Guest

  3. #3

    Default Re: [PHP] HTML equivalents of accented characters

    > I think php.net/htmlentities will do this.

    Apparently it *is*, but it won't for me. Any problems with this code?

    $result[] = "";
    $result[1] = htmlspecialchars($result[0]);
    $result[2] = htmlentities($result[0]);

    Both return the accented E unchanged.

    Liam Gibbs Guest

  4. #4

    Default Re: [PHP] HTML equivalents of accented characters

    > I bet they do, did you check the HTML source as well? My guess is that the
    > source is reading the actual expected output, but your browser views "",
    as
    > it should of course.
    Sorry, should have mentioned. The source code reads the actual character,
    not the &eacute;.

    Liam Gibbs Guest

  5. #5

    Default Re: [PHP] HTML equivalents of accented characters

    "Liam Gibbs" <liamgibbssympatico.ca> wrote in message
    news:002b01c36194$dec89fd0$4d59fea9TeletranOne...
    > > I bet they do, did you check the HTML source as well? My guess is that
    the
    > > source is reading the actual expected output, but your browser views
    "",
    > as
    > > it should of course.
    > Sorry, should have mentioned. The source code reads the actual character,
    > not the &eacute;.
    Hmmm... interesting... I tested your exact code in this format :

    <?php
    $result[] = "";
    $result[1] = htmlspecialchars($result[0]);
    $result[2] = htmlentities($result[0]);

    foreach ($result as $val) {
    print ("[" . $val . "]");
    }
    ?>

    which returned (sourcecode)
    [][][&eacute;]

    So with me, htmlentities works. Did you try this :

    $a = get_html_translation_table(HTML_ENTITIES);
    var_dump($a);

    ? With me, it returns a 99 elements array with loads of characters,
    including the "". (PHP/4.2.3 on Win2000)

    I have no idea what might be the problem, what does your translation table
    look like?

    --
    Ivo Fokkema


    Ivo Fokkema Guest

  6. #6

    Default Re: [PHP] HTML equivalents of accented characters

    > I have no idea what might be the problem, what does your translation table
    > look like?
    Mine is still coming out as a single character. Here's my code, in case
    anyone can spot any stupid human error blunder I'm making:

    $translationtable = get_html_translation_table(HTML_ENTITIES);
    $string = htmlspecialchars($string);

    Also, here's my setup, just in case:
    PHP 4.3.1
    Linux 2.2.19 #1 i586
    Apache 1.3.27
    MySQL 3.23.49 (don't know what this has to do with it, but just in case
    there has been some interference with PHP and MySQL)
    GD 2.0 compatible

    Liam Gibbs Guest

Similar Threads

  1. Accented characters in PHP code messed up
    By PolyWebTech in forum Macromedia Contribute General Discussion
    Replies: 2
    Last Post: October 7th, 06:42 AM
  2. CFFILE and extended ASCII/accented characters
    By tomtedeschi in forum Coldfusion - Advanced Techniques
    Replies: 3
    Last Post: March 30th, 09:16 PM
  3. Canvas Equivalents?
    By Bobby Henderson in forum Macromedia Freehand
    Replies: 7
    Last Post: April 11th, 12:18 AM
  4. Pagemaker equivalents
    By Rick_Yurick@adobeforums.com in forum Adobe Indesign Windows
    Replies: 8
    Last Post: April 6th, 09:59 PM
  5. MX and Panther: can't type accented characters
    By djfilms@rogers.com in forum Macromedia Director Basics
    Replies: 0
    Last Post: April 2nd, 08:08 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