Results 1 to 2 of 2

Thread: Problem with non-unicode chars in ajax-like part

  1. #1
    kosmidis is offline Junior Member
    Join Date
    Sep 2006
    Posts
    4

    Cool Problem with non-unicode chars in ajax-like part

    Hello to everyone... Can someone help me?
    I installed sugarcrm in a windows sbs with apache 2, php 4 and mysql 4

    I changed iso encoding to iso-8859-7 on every file needed and have no problem with greek storing it on the database or retrieving it...
    Problem comes from the "Select" buttons or from the "ajax-like" menu

    Example:
    Let's say you save an account with a greek account name "τεστ account". This is done great so far...
    Then go to "Contacts" create a new one and try to fill in account name. It cannot be found if i press "τ" cause it sees greek chars as garbage characters. If I press "Select" I see the account name correctly. When I click on the account name hoping to pass infos back to the "Contacts" page it pass it again with garbage chars (like Αντώνη Μίγγα).

    Any ideas?
    I search in all files for iso-8859-1 and replaced it with iso-8859-7. i even set "SET NAMES GREEK" after mysql_connect.
    Maybe a file(s) needs to be saved with different encoding(converted as utf8 or something)?

    Thank you very much
    George Kosmidis
    Last edited by kosmidis; 2006-09-01 at 11:16 AM.

  2. #2
    kosmidis is offline Junior Member
    Join Date
    Sep 2006
    Posts
    4

    Unhappy Re: Problem with non-unicode chars in ajax-like part

    After a little search i found that "includes/JSON.php" does a conversion that completely ruins the greek part of string...
    See my solution but i could use a better one... You will see why

    I found that if change line 131 from
    PHP Code:
    $ascii .= sprintf('\u%04s',bin2hex($char)); 
    to
    PHP Code:
    $ascii .=  $char//sprintf('\u%04s',bin2hex($char)); 
    it works fine, but what happens with future updates?

    Bigger part of script
    PHP Code:
    if ($this->multibyte == false) {
       if (
    ord($var{$c}) <= 0xFF) {
          
    $char pack('C*'ord($var{$c}));
          
    $ascii .=  $char//sprintf('\u%04s',bin2hex($char));
       
    } else {
          
    $ascii .= $var{$c};                                    
       }                            
    } else {... 
    Last edited by kosmidis; 2006-09-01 at 10:57 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
  •