I have problem with detecting CP1250 in mb_detect_encoding(), in my case I want detect 3 encodings:
mb_detect_encoding($string, 'UTF-8,ISO-8859-2,Windows-1250')
But Windows isn't in supported encodings, any solution?
I have problem with detecting CP1250 in mb_detect_encoding(), in my case I want detect 3 encodings:
mb_detect_encoding($string, 'UTF-8,ISO-8859-2,Windows-1250')
But Windows isn't in supported encodings, any solution?
It is not feasible to distinguish ISO-8859-2 from Windows-1250, or any other single-byte encoding from any other encoding for that matter.
mb_detect_encoding
simply gives you the first encoding which is valid for the given string, and both are equally valid. "Detecting" encodings is by definition not possible with any amount of accuracy.mb_detect_encoding
always "detects" single-byte encodings. You can read about this in the documentation formb_detect_order
:Conclusions:
In general, it is impossible to detect single-byte encodings with accuracy. If you find yourself needing to do that in PHP you will need to do it manually; don't expect very good results.