COMMUNITY

Odd php error no mapping for the unicode character exists in the target multi-byte code page

I embedded haxe output into an existing php site, since then I am recently recieving an error

on php scandir calls,
no mapping for the unicode character exists in the target multi-byte code page.

When I comment out the haxe generated code,

the error doesn’t show up

As far as i google, the text doesn’t seem to originate from php but from the OS (windows)

but couldn’t find a solution doesn’t come up, i searched the haxe output for set codepage, charset etc.

but didn’t found anything what can it be?

What is the exact error message?

Fatal error : Uncaught ErrorException: scandir(C:/IL/PINTEL/8488475853/8 Rabbi house and guest Services/1 Rabbis house,C:/IL/PINTEL/8488475853/8 Rabbi house and guest Services/1 Rabbis house): No mapping for the Unicode character exists in the target multi-byte code page. (code: 1113) in C:\xampp\htdocs\files.php:813 Stack trace: #0 [internal function]: php\Boot::php{closure}(2, ‘scandir(C:/IL/P…’, ‘C:\xampp\htdocs…’, 813, Array) #1 C:\xampp\htdocs\files.php(813): scandir(‘C:/IL/PINTEL/84…’) #2 {main} thrown in C:\xampp\htdocs\files.php on line 813

Hmmmm… The PHP target only deals with UTF-8 encoding (cf. https://github.com/HaxeFoundation/haxe/blob/development/std/php/Boot.hx#L59). It seems that the string that you pass to scandir contains non-UTF8 characters.

Great, at least i understand where to look and fix.

Now I understand why it was working sometimes and sometimes not, based on the browser POST encoding.

Thanks