You are here

function rtf::escapeCharacter in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 modules/rtf/rtf_export.inc \rtf::escapeCharacter()
  2. 7 modules/rtf/rtf_export.inc \rtf::escapeCharacter()
  3. 7.2 modules/rtf/rtf_export.inc \rtf::escapeCharacter()
1 call to rtf::escapeCharacter()
rtf::specialCharacters in ./class_rtf.php

File

./class_rtf.php, line 285

Class

rtf

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;
}