webster Posted April 12, 2017 Share Posted April 12, 2017 Hello, I need help in using split with utf8 string like below: <!DOCTYPE html><html><body><script>var numbers;var Emoj1 = ' Quote Link to comment https://forums.phpfreaks.com/topic/303698-need-help-in-split-function-utf8-string/ Share on other sites More sharing options...
Solution requinix Posted April 12, 2017 Solution Share Posted April 12, 2017 Seems .split is not Unicode safe. Seems like ECMAScript says it should be... Use .match(RegExp) instead. With the /u flag it will match every Unicode character in the string. numbers = what.match(/./gu); 1 Quote Link to comment https://forums.phpfreaks.com/topic/303698-need-help-in-split-function-utf8-string/#findComment-1545397 Share on other sites More sharing options...
webster Posted April 13, 2017 Author Share Posted April 13, 2017 Thanks requinix,it is working. Quote Link to comment https://forums.phpfreaks.com/topic/303698-need-help-in-split-function-utf8-string/#findComment-1545409 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.