WordPress.org

Ready to get started?Download WordPress

Forums

Cyryllic chars in plugins (1 post)

  1. hategrinder
    Member
    Posted 6 years ago #

    Hello! I have the following problem: when I execute code

    $a=preg_split("#([\w]+)#i","Привет, дружище!", -1, PREG_SPLIT_DELIM_CAPTURE);
    print_r($a);

    Outside of WordPress, it returns

    Array
    (
        [0] =>
        [1] => Привет
        [2] => ,
        [3] => дружище
        [4] => !
    )

    What is correct. However, when I do it in the plugin:
    $this->words=preg_split("#([\w]+)#i","Привет, дружище!",-1,PREG_SPLIT_DELIM_CAPTURE);
    print_r($this->words);

    It returns
    `Array
    (
    [0] =>
    [1] => Приве�
    [2] => �,
    [3] => дру�
    [4] => �
    [5] => и�
    [6] => �
    [7] => е
    [8] => !
    )`
    Even more, the latter crappy array changes every time! Any suggestions? TIA

    By the way, the same issue can be seen even after you make the brand new installation and then change the text of "Hello, Dolly" plugin to some cyryllics - it won't display!

Topic Closed

This topic has been closed to new replies.

About this Topic