11

Which multibyte-handling library should I use : iconv or mbstring ?

After some Googling I didn't find enough arguments to convince me to use one particularly, and I could not get any benchmark (and I'm too lazy do create one :-p).

After all maybe this choice doesn't really matters ?

Thanks for any piece of advice.

Maxime Pacary
  • 22,336
  • 11
  • 85
  • 113
  • mbstring is more safe, http://stackoverflow.com/questions/9375909/iconv-utf-8-ignore-still-produces-illegal-character-error and https://github.com/MindscapeHQ/raygun4php/pull/69 – Yousha Aleayoub Aug 10 '16 at 09:35

1 Answers1

7

I tend to use a combination of both - depending on my needs. I use iconv to convert from one charset to another, but mbstring for simpler operations like mb_strtoupper() and mb_stristr(). But if only one of the libraries is needed I suggest using mbstring purely for it's widespread functionalities and ease of use.

Repox
  • 15,015
  • 8
  • 54
  • 79