I'm trying to have my output show the entity. I'm trying to write a script that would export rows so that they can be imported elsewhere.

When I go to import my data, the text ends up looking like the original data.

    Ok, that's what it sounded like. Take a look at the first link I put up and this example is how it works:

    $html = ".ả";
    echo "Before:<br/>";
    echo $html;
    echo "<br/>";
    echo "After:<br/>";
    echo htmlentities($html);
    

    Here is the output form that:

    Before:
    &#7843;
    After:
    ..&#7843;
    

    Last Edit:
    Added a period infront of .&#7843; so it won't get converted when it's not supposed to, so I can actually show what I'm trying to show.,,

      personally I would set everything to utf8 (page\db\db connection), then you don't need to encode\decode use HTML entities, just remember to use the php multi-byte functions as the native support for multi-byte characters is poor.

        I tried htmlentities() before only to find that it converts a lot more than needed (the letter a with the accent)

        I never used multibyte string functions before so I don't know where to start

        Edit:
        I've attached my import and export scripts along with the xml file that I'm trying to re-import.
        Hopefully this helps

          [Off topic]
          I cannot edit my post? o_O
          [/Off topic]

          I think I got this figured out

          I wrote the following function that would turn all & to &amp;

          function jU_encode($string) {
          	return utf8_encode(str_replace("&", "&amp;", $string));
          }

          As a result, I got my desired result
          I'm still trying to understand as to why it worked out

          Thanks for your input 🙂

            Write a Reply...