Author: Lars Moelleken
Updated on: 2019-09-08
Posted on: 2019-09-08
Viewers: 117 (September 2019 until May 2020)
Last month viewers: 5 (May 2020)
Package: Portable UTF-8
Mostly we are using UTF-8 encoding in our projects and it's working, but if you need to process third party data maybe with unknown encoding it can be painfully. So here comes a auto-detection for this kind of strings.
In "Portable UTF-8" I have implemented a auto-detect character encoding function with support for UTF-16 and UTF-32. So for example if your customer send you a mix of UTF-16 or UTF-8 or ISO ... encoded CSVs you can detect the encoding via:
You can also auto-convert the encoding and this function will also try to fix broken / double encoding, so you can call this function also on a UTF-8 string and you don't mess the string.
You need to be a registered user or login to post a comment
1,559,318 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
No comments were submitted yet.