Transliteration
On this page
Transliteration converts text from one writing system into another in a systematic way.
You can use this with WHMCS to automatically replace characters in client profile data that third-party systems may reject. For example, a domain registrar’s API might automatically reject certain characters in received requests.
Custom Transliteration Function
WHMCS includes a default function to find and replace the most common special characters that cause problems.
You can tailor this to your unique needs by defining a hook_transliterate
function in the /includes/hooks/
directory. This will override the default function and allow you to specify your own character replacements.
For example, if you created the following file, the transliteration system would convert the client name Jéssé žuckérbérg to Jesse Zuckerberg when performing a request using a module (for example, a domain registrar):
<?php
function hook_transliterate($string) {
$string = str_replace("ž", "z", $string);
$string = str_replace("é", "e", $string);
return $string;
}
?>
To use this, return the converted string at the end of the call. You do not need to use the add_hook
function with this feature.
Last modified: November 12, 2024