Testing UTF8 charaters

Discussion in 'PHP' started by SGBoise, Aug 12, 2008.

  1. #1
    Hello,

    I am in the process of converting my script to support multi languages. I am using utf8 for my charset and I have mysql and php configured to work with it.

    Now I just realized I don't have a way of typing utf8 special characters to test out my script.

    I live in the us and I just have a qwerty keyboard and I'm running Windows..

    Does anyone if there there is any special software can allow me to enter special characters?

    Thanks.
     
    SGBoise, Aug 12, 2008 IP
  2. minibuck

    minibuck Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I know some software can do that.
    you can try type Vietnamese with this tool , it is free unikey.org
    Why don't you search for foreign websites and copy their text, Most of Asian website use unicode utf-8.
     
    minibuck, Aug 12, 2008 IP
  3. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i think you are looking for iconv!! heres and example from php.net
    ----------------------------------------------------------------------------------
    If you need to strip as many national characters from UTF-8 as possible and keep the rest of input unchanged (i.e. convert whatever can be converted to ASCII and leave the rest), you can do it like this:
    
    
    
    <?php
    setlocale(LC_ALL, 'en_US.UTF8');
    
    function clearUTF($s)
    {
        $r = '';
        $s1 = iconv('UTF-8', 'ASCII//TRANSLIT', $s);
        for ($i = 0; $i < strlen($s1); $i++)
        {
            $ch1 = $s1[$i];
            $ch2 = mb_substr($s, $i, 1);
    
            $r .= $ch1=='?'?$ch2:$ch1;
        }
        return $r;
    }
    
    echo clearUTF('Šíleně žluťoučký Vašek úpěl olol! This will remain untranslated: ᾡᾧῘઍિ૮');
    //outputs Silene zlutoucky Vasek upel olol! This will remain untranslated: ᾡᾧῘઍિ૮
    ?>
    
    PHP:
    -- SOURCE -- http://uk2.php.net/manual/en/function.iconv.php
     
    cornetofreak, Aug 12, 2008 IP
  4. SGBoise

    SGBoise Peon

    Messages:
    647
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4

    Thanks, I didn't think about coping text from other web sites.
     
    SGBoise, Aug 12, 2008 IP
  5. SGBoise

    SGBoise Peon

    Messages:
    647
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The Character Map that comes with Windows is a pretty good tool to get unicode characters. I am using XP and it Advanced View that lets you filter and group them.
     
    SGBoise, Aug 12, 2008 IP