Ignore:
Timestamp:
03/19/2009 12:38:08 AM (3 years ago)
Author:
ofer
Message:

Fix the problems of special characters part#2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/transposh.php

    r72 r73  
    228228    $translated = NULL; 
    229229    logger("Enter " . __METHOD__ . ": $original", 4); 
     230    logger("Original was: $original", 3); 
    230231    $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8')); 
    231232    logger("Original is: $original", 3); 
     
    393394} 
    394395 
     396/* 
     397 * Helper function for annoying strings from php escape (%u2019) 
     398 */ 
     399function utf8_urldecode($str) { 
     400    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str)); 
     401    return html_entity_decode($str,null,'UTF-8');; 
     402  } 
    395403 
    396404/* 
     
    422430    //Decode & remove already escaped character to avoid double escaping 
    423431    // TODO: remove logging? 
    424     logger("orig:" .$original,4); 
    425     $original    = $wpdb->escape(stripslashes(urldecode(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8')))); 
     432    logger("origwas:" .$original,4); 
     433    $original = utf8_urldecode($original); 
     434    logger("orig2:" .$original,4); 
     435    $original    = $wpdb->escape(stripslashes(urldecode(html_entity_decode($original, null, 'UTF-8')))); 
    426436    logger("orig:" .$original,4); 
    427437    $translation = $wpdb->escape(htmlspecialchars(stripslashes(urldecode($translation)))); 
Note: See TracChangeset for help on using the changeset viewer.