pathauto_clean_string and accents from a bootstrap PHP file I have a single PHP file which makes a bootstrap of Drupal 7. The code is below. When I try to use pathauto_clean_string in a spanish string with accents (á é ... , etc.) it deletes the character instead of removing the accent using transliteration module (also affects other special chars, obviously). I have included also this module in the bootstrap but cannot have the PHP script to behave exactly as the Drupal site, which is doing properly the transliteration in file names and also from my own custom module.

define('DRUPAL_ROOT','/home/example.com/public_html');
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/sites/all/modules/transliteration/transliteration.inc'; 
 require_once DRUPAL_ROOT . '/sites/all/modules/pathauto/pathauto.inc';

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

if(isset($_GET['string'])) echo pathauto_cleanstring(urldecode($_GET['string']));


Result with www.example.com?string=está-cañón : est-can

Result with the same string and module, same function and correct, expected, result: esta-canon
After having a look at the code from the pathauto_cleanstring function, I would suggest testing the following:


Checking the value of pathauto_transliterate prior to calling the pathauto_cleanstring function 

variable_get('pathauto_transliterate', FALSE)     
If that value is FALSE, you probably found the reason. Try setting that variable to TRUE to force use of transliteration inside the pathauto_cleanstring function. N.B.: You only need to set this value once.

variable_set('pathauto_transliterate', TRUE), or
drush vset pathauto_transliterate TRUE    
Try your code again. Fingers crossed!


I suspect that your code never actually uses the transliterate function, but that is something that you can check by dumping the 'pathauto_transliterate' variable in the various scenarios where your code is executed (in-module, custom script, etc.)