function rtf::escapeCharacter in Bibliography Module 6.2
Same name and namespace in other branches
- 6 class_rtf.php \rtf::escapeCharacter()
- 7 modules/rtf/rtf_export.inc \rtf::escapeCharacter()
- 7.2 modules/rtf/rtf_export.inc \rtf::escapeCharacter()
1 call to rtf::escapeCharacter()
- rtf::specialCharacters in modules/
rtf/ rtf_export.inc
File
- modules/
rtf/ rtf_export.inc, line 284
Class
Code
function escapeCharacter($character) {
$escaped = "";
if (ord($character) >= 0x0 && ord($character) < 0x20) {
$escaped = "\\'" . dechex(ord($character));
}
if (ord($character) >= 0x20 && ord($character) < 0x80 || ord($character) == 0x9 || ord($character) == 0xa) {
$escaped = $character;
}
if (ord($character) >= 0x80 and ord($character) < 0xff) {
$escaped = "\\'" . dechex(ord($character));
}
switch (ord($character)) {
case 0x5c:
case 0x7b:
case 0x7d:
$escaped = "\\" . $character;
break;
}
return $escaped;
}