Important: This page is using cookies (cookies). Using this website without turning off cookies in browser, means that you agree for using it.
Buy Now! Features Downloads

Earn with us!

If you would like to start earning money with vBET join to Affiliate Program.
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Accents not displaying correctly...

  1. #11
    Junior Member
    Join Date
    Feb 2011
    Posts
    9

    Default

    Quote Originally Posted by kamilkurczak View Post
    yes. I can confirm it on my test forum!
    This is a vBET bug so I need to move this thread into bug reporting section.

    I noticed that there is a encoding issue with letters with ASCII code under Ā

    I can reproduce it on my test forum so I can fix it without access to your forum

    I will try to find the best solution for you.
    Well the good news is that I fixed the problem myself. The bad news is that I cannot confirm that this solution will work as a replacement function... as it only works on my forums.

    Regardless, here is the new function:

    PHP Code:
    function vbet_encodeToSafeUTF8(&$string) {

         
    $string utf8_decode($string);           
         return 
    $string;

    This function converts UTF-8 to ISO-8859-1

  2. #12
    vBulletin Enterprise Translator (vBET) Staff
    Join Date
    May 2010
    Posts
    1,000

    Default

    thanks for this good news. I will test it and confirm

  3. #13
    vBulletin Enterprise Translator (vBET) Staff
    Join Date
    May 2010
    Posts
    1,000

    Default

    hello,
    Your solution is not good in generally. Why? This is working with letters with ASCII code under 256 (converted and displayed good) but letters with ASCII code over 256 I have "?" signs.

    So We need to combine our two solutions in one

    example:
    PHP Code:
    function vbet_encodeToSafeUTF8(&$string) {
            
            
    $string preg_replace('/([\340-\357])([\200-\277])([\200-\277])/e',        
                    
    '\'&#\'.((ord(\'\\1\')-224)*4096 + (ord(\'\\2\')-128)*64 + (ord(\'\\3\')-128)).\';\'',    
                    
    $string); 
         
            
    //decode two byte unicode characters 
            
    $string preg_replace('/([\304-\337])([\200-\277])/e'
                    
    '\'&#\'.((ord(\'\\1\')-192)*64+(ord(\'\\2\')-128)).\';\''
                    
    $string); 
            
            
    $string utf8_decode($string);            
            
            return 
    $string;
        } 
    this line:
    PHP Code:
    [\304-\337
    define than letters with ASCII code under 256 will be not decoded by my function but only by
    PHP Code:
    utf8_decode 
    I am testing it still.I am not entirely sure that everything works correctly now.
    You can test it too!

  4. #14
    Junior Member
    Join Date
    Feb 2011
    Posts
    9

    Default

    For my purposes, the solution works fine... as I'm only translating into two langauges... English and French. Both are ISO-8859-1 (latin1) languages. Therefore the "utf_decode" function works fine.

    However, with a global scope in view, the utf_decode function will probably not work for other languages outside of "latin1".

    I am not much of a vbulletin programmer. However, I will offer one suggestion:

    Perhaps using an "If" statement may suit your purposes better if your solution does not work. In the example below, the "translated_language_var" would be the destination language to translate into.

    IE:
    PHP Code:
    $latin1 = array(English,French,Spanish,Italian....etc);

    if (
    in_array(translated_language_var,$latin1)){

      
    $string utf_decode($string);

    }else{
      
      
    original solution;
    }

    return 
    $string
    Perhaps using something like this would be a sure method to keep everything safe...??? I'm sure you could easily use this pseudo code and make it work for vbulletin.
    Last edited by freddie3218; 14-03-11 at 05:12.

  5. #15
    vBulletin Enterprise Translator (vBET) Staff
    Join Date
    May 2010
    Posts
    1,000

    Default

    solved - will be included in the next relase

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •