raveren/kint — pull request #15 by deeweird (2012-08-12 21:57:15+00:00)
Title: Encoding selection support

Hi, Raveren! Thank you for such an amazing tool, debugging PHP code is so much better with Kint :)

The problems I ran into using Kint with Russian language (mostly due to PHP's broken mb_detect_encoding() ) and made a fix of:
1) With UTF-8 encoding Kint s() and d() showed incorrect string sizes of strings and d() output was garbage:
http://dl.dropbox.com/u/29937772/Kint/1_kint_raveren.png
Fixed: http://dl.dropbox.com/u/29937772/Kint/1_kint_me.png

2) With WINDOWS-1251 encoding string lengths were reported correctly, but string previews for d() were broken:
http://dl.dropbox.com/u/29937772/Kint/2_kint_raveren.png
Fixed: http://dl.dropbox.com/u/29937772/Kint/2_kint_me.png

I should also note, that my patch makes a small regression: if the variables contain text in WINDOWS-1251, but Kint::$encoding is set to UTF-8(default), your version's s() and d() report correct strlen, while mine don't. Both versions truncate d() string previews.
Right strlen: http://dl.dropbox.com/u/29937772/Kint/3_kint_raveren.png
Wrong strlen: http://dl.dropbox.com/u/29937772/Kint/3_kint_me.png
I am not sure this can be fixed at all.