Search code examples
phpstringnon-englishcyrillic

PHP Russian characters


I have the following php code that I need to run on linux:

$BannedList = array
(
  'рублей'=> 'i'
);

foreach ( $BannedList as $BannedWord => $Option )
  if ( preg_match ( '#\\b'. preg_quote( $BannedWord, '#' ). '\\b#'. $Option,
                    $message_parser -> message )
     )
  {
    $error[]= ' ';
    break;
  }

The problem I am having is I have no idea how to use vi to enter the russian charcaters. Secondly, even if I have a way to type the russian characters, the php file is just a normal ascii file and incapable of holding the russian characters. So, how can I create a file containing this code ? Additionally, if I end up using a utf-8 file format, do I have to tell the php interpreter that this file is different to all the other ascii files it is running ?


Solution

  • Took hours of random thrashing before finally arriving at the solution. The russian charcacters could be specified using unicode:

    $BannedList = array
    (
      '\x{0440}\x{0443}\x{0431}\x{043B}\x{0435}\x{0439}' => 'iu'
    );