You are here

protected function EasyRdf_Serialiser_Ntriples::escapeString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Ntriples.php \EasyRdf_Serialiser_Ntriples::escapeString()

@ignore

3 calls to EasyRdf_Serialiser_Ntriples::escapeString()
EasyRdf_Serialiser_Ntriples::serialise in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Ntriples.php
Serialise an EasyRdf_Graph into N-Triples
EasyRdf_Serialiser_Ntriples::serialiseResource in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Ntriples.php
@ignore
EasyRdf_Serialiser_Ntriples::serialiseValue in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Ntriples.php
Serialise an RDF value into N-Triples

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Ntriples.php, line 53

Class

EasyRdf_Serialiser_Ntriples
Class to serialise an EasyRdf_Graph to N-Triples with no external dependancies.

Code

protected function escapeString($str) {
  if (strpos(utf8_decode(str_replace('?', '', $str)), '?') === false) {
    $str = utf8_decode($str);
  }
  $result = '';
  $strLen = strlen($str);
  for ($i = 0; $i < $strLen; $i++) {
    $c = $str[$i];
    if (!isset($this->escChars[$c])) {
      $this->escChars[$c] = $this
        ->escapedChar($c);
    }
    $result .= $this->escChars[$c];
  }
  return $result;
}