This project is archived and is in readonly mode.

#3345 ✓committed
Ryan Sonnek

to_json does not escape unicode characters

Reported by Ryan Sonnek | October 7th, 2009 @ 10:27 PM

The current JSON encode method does not properly escape non-ascii characters.

'bad characters'.concat(16).to_json => ""bad characters\020""

Should be:
=> ""bad characters\u0010""

The ruby json gem works correctly and an acceptable work around would be to have the ActiveSupport::JSON.encode method delegate to the ActiveSupport::JSON.backend (which can be configured to use the ruby json gem)

tested in rails 2.3.4

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Referenced by

Pages