Code Snippet to convert Polish/German characters to Latin.

The following code snippet allows you to convert Polish/German character to Latin.

You can paste the snippet under Appearance –> Editor –> functions.php.

Without Snippet the text appears as junk as shown by screenshot – 

Without Code snippet

Without Code snippet

With Snippet the text appears correct – 

With Code Snippet

With Code Snippet

Comments (3)

  • Marta
    Marta

    /**Polish characters to Latin*/

    add_filter(‘wf_ups_shipment_confirm_request’, ‘wf_ups_convert_charset’);

    function wf_ups_convert_charset($request){
    return str_replace([‘ę’, ‘Ę’, ‘ó’, ‘Ó’, ‘ą’, ‘Ą’, ‘ś’, ‘Ś’, ‘ł’, ‘Ł’, ‘ż’, ‘Ż’, ‘ź’, ‘Ź’, ‘ć’, ‘Ć’, ‘ń’, ‘Ń’,’ś’, ‘Ś’], [‘e’, ‘E’, ‘o’, ‘O’, ‘a’, ‘A’, ‘s’, ‘S’, ‘l’, ‘L’, ‘z’, ‘Z’, ‘z’, ‘Z’, ‘c’, ‘C’, ‘n’, ‘N’,’s’, ‘S’], $request);
    }

    February 9, 2017 at 7:05 pm
  • Marta
    Marta

    Nice idea, but it doesn’t work with Polish 🙁

    February 8, 2017 at 11:52 pm
    • Mujeebu
      Mujeebu

      Hello Marta,

      Please check your function is getting executed. Your function seems fine to replace the strings as you mentioned.Where exactly you are putting these codes.

      February 9, 2017 at 9:37 pm

Leave a Reply