ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am playing with some chinese characters and would like to find a specific character to split the text into 2 strings.For example,"你/我" will become 2 strings,str1=你,str2=我.However,it doesn't seem to react correctly if I grab the text from the web and then do the search with strpos or preg_match.It does the trick if I copy and paste those words to my php page.I doubt that is the problem with encoding.But I don't know exactly how I solve this.
Do you guys have any clue?Please drop me a line if you do.
I have looked at the links you specified.However,It doesn't seem like I know exactly how to do it technically.My situation goes like this:
1.I retrieved certain chinese characters from a website.(It uses BIG-5 encoding).
2.Then I try to find certain string "/" but it failed.
However,as I have told,if I copy those strings to the php file and search that special character,it works out perfectly.I don'know why.If I do,I can use the same method to solve my problem.
Maybe you need to convert the page you got from a website from BIG-5 encoding to UTF-8? I don't even know what BIG-5 is, but I've used the iconv function in similar situations to convert everything to UTF-8, before doing stuff with the mbstring functions.
I have just rewritten the code like you said.Fortunately,it can detect the special character with mb_strpos after I used mb_convert_encoding to UTF-8 from BIG-5.It's better than iconv as I used it.However,it's not successfully completed the task after I used mb_split.The first part of string is successful but the second part become monster code.I guess that the mb_split is not fully successful to split out the string.As the manual said,if the split process failed,like the character cannot get all the bytes information which it needed,the output character will become monster code.
I do think the trouble of multibyte characters is the biggest problem I found in PHP.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.