1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

UTF8 Problems

Discussion in 'How-To and Troubleshooting' started by narc, Aug 31, 2010.

  1. narc

    narc Well-Known Member

    Hi, I'm almost finished with my project. Now I remember but
    on the Hotaru no UTF8 do?

    Here's an example - Source of Hotaru
    Code:
    L[COLOR="#ff00ff"]ö[/COLOR]sung k[COLOR="#ff00ff"]ö[/COLOR]nnen Dialogmarketingaktionen wie Pr[COLOR="#ff00ff"]ä[/COLOR]mien-, Cashback- oder Treueaktionen
    must be converted to utf8
    Code:
    L[COLOR="#008000"]ö[/COLOR]sung k[COLOR="#008000"]ö[/COLOR]nnen Dialogmarketingaktionen wie Pr[COLOR="#008000"]ä[/COLOR]mien-, Cashback- oder Treueaktionen
    Output on the website
    Code:
    L[COLOR="#00bfff"]ö[/COLOR]sung k[COLOR="#00bfff"]ö[/COLOR]nnen Dialogmarketingaktionen wie Pr[COLOR="#00bfff"]ä[/COLOR]mien-, Cashback- oder Treueaktionen
    Or do I have a slightly different setting? So it's not, anyway. I
    get a huge pile of errors in the HTML validator.
     
  2. petsagouris

    petsagouris Design & Development

    Is the first line is on in a '_language.php' file ?
     
  3. narc

    narc Well-Known Member

    mean you: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> ?
     
  4. petsagouris

    petsagouris Design & Development

    No I mean this :
    Code:
    L[COLOR="#ff00ff"]ö[/COLOR]sung k[COLOR="#ff00ff"]ö[/COLOR]nnen Dialogmarketingaktionen wie Pr[COLOR="#ff00ff"]ä[/COLOR]mien-, Cashback- oder Treueaktionen
     
  5. narc

    narc Well-Known Member

    it is the source code from my internet site. the sentence comes from an article that was created with hotaru. usually must hotaru my text but convert to UTF8, and so save in the database. should read the source code available in the L&ouml;sung, not Lösung.
     
  6. carlo75

    carlo75 Design & Development

    Have you checked collation of your database?
     
  7. narc

    narc Well-Known Member

    yes: MyISAM utf8_unicode_ci - all tables
     
  8. narc

    narc Well-Known Member

    any ideas?
     
  9. petsagouris

    petsagouris Design & Development

    Nobody is getting payed to solve problems apart from Nick and that is only if he takes the job.
    Now in Japan it is around 08:00 am, even he didn't have his coffee yet.

    Anyhow, you seem to be right, it looks like that Hotaru is not touching the strings it outputs or inputs so that it replaces the utf8 characters with the HTML characters.
    For reference: charset_encode_utf8, charset_decode_utf8
     
  10. Nick

    Nick Well-Known Member

    I just submitted this post on my test site and used the first paragraph as the description. This was the result:

    utf8_test.png

    That looks fine to me so what is the difference between how I submitted it and how you submitted it?
     
  11. narc

    narc Well-Known Member

    that's right nick. problem is that is the html code coded incorrectly. output of the letter is correct. But the validator finds errors, because it is not in UTF8 source code.
     
  12. Nick

    Nick Well-Known Member

    I pasted the source code into the validator, and...

    utf8validated.png

    So what's the difference? How did you get this:

    I don't see those characters at any time during or after submission, even in the source code. :confused:
     
    Last edited by a moderator: Sep 1, 2010
  13. narc

    narc Well-Known Member

    with you in the source code, the sign was not converted. see for my image.

    ö must be converted in to &ouml;
    ü must be converted in to &uuml;
    ä must be converted in to &auml;
    ...

    perhaps the error is on my imported Pligg-database?

    EDIT: image nr2 with my source code in notepad++
     

    Attached Files:

    Last edited: Sep 1, 2010
  14. Nick

    Nick Well-Known Member

    If the post was imported from Pligg, then it's very likely those strange characters would be present. If there are only a few of them in German, then try this:

    1. Open /functions/funcs.strings.php
    2. Find this:

    PHP:
    function strip_foreign_characters($str)
    {
        
    $str str_replace('Â'''$str);
        
    $str str_replace('’''\''$str);
        
    $str str_replace('–''-'$str);
        
    $str str_replace('“''"'$str);
        
    $str str_replace('â€￾''"'$str);
        return 
    $str;
    }
    Change the values so that str_replace('strange_character', 'desired character', $str);

    3. Save and upload
    4. Backup your database
    5. Enable the Pligg2Hotaru plugin
    6. Click "Run the Character Cleaner" and wait for it to finish.
     
    narc likes this.
  15. narc

    narc Well-Known Member

    many thanks, i test your solution.
     

Share This Page