Example #1
0
 /**
  * Get msgfmt script path
  *
  * @return string
  */
 protected function getMsgFmtExecutable()
 {
     if (is_null($this->msgfmtPath)) {
         $this->msgfmtPath = func_find_executable('msgfmt');
     }
     return $this->msgfmtPath;
 }
Example #2
0
 /**
  * Convert charset
  *
  * @param string $from       From charset
  * @param string $to         To charset
  * @param string $path       File path
  * @param string $outputPath Output file path OPTIONAL
  *
  * @return boolean
  */
 public function convertFile($from, $to, $path, $outputPath = null)
 {
     $result = false;
     $outputPath = $outputPath ?: $path;
     $exec = func_find_executable('iconv');
     if ($exec) {
         exec($exec . ' -s' . ' --from-code=' . $from . ' --to-code=' . $to . ' --output=' . escapeshellarg($outputPath) . ' < ' . escapeshellarg($path));
         $result = true;
     }
     return $result;
 }