getsentry/raven-python — pull request #256 by MaratFM (2013-02-10 07:38:31+00:00)
Title: Update raven/utils/serializer/base.py

This is hot fix for one problem with truncating utf8 encoded strings.

If string in value is utf8 encoded raw string, then after truncating it may be truncated on the middle of unicode char. After that json.dumps will fail, for example:
```python
import json
print json.dumps({1: '\xd1\x88\xd1\x82'})
{"1": "\u0448\u0442"}
json.dumps({1: '\xd1\x88\xd1\x82'[:3]})
UnicodeDecodeError
```

I know that this is not the best solution, because it add additional encode/decode operations. I believe that you will find more beautiful.

Thanks

P.S. My environment: Python 2.6.6 (r266:84292), raven.VERSION '3.1.4'