single quote character not escaped in REST output

Created on 6 April 2016, about 8 years ago
Updated 28 April 2023, about 1 year ago

GET json and hal+json output does not escape single quote character.
Other characters such as em dash, greater than and forward slash escape correctly.

To reproduce this issue

  • on a clean install, create a node with a single quote in title or body field
  • enable modules: HAL, Restful Web Services, Serialization
  • check JSON and/or HAL+JSON output; methods used so far to check output: Views Rest Export and curl
🐛 Bug report
Status

Active

Version

10.1

Component
REST 

Last updated about 8 hours ago

Created by

🇺🇸United States kay_v

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇰Denmark ressa Copenhagen

    In 🐛 REST views: double encoding of apostrophes in REST Export display Needs work there's a patch which fixes partially that single quotes (') are not just printed, but changed and then garbled in REST outputs.

    "Côte d'Ivoire" now in a REST output in json format:
    "name": "C\u00f4te d\u0026#039;Ivoire"

    After patching:
    "name": "Côte d'Ivoire"

    Since single quotes don't need escaping because proper json output is in double quotes, shouldn't the output be this?
    "name": "Côte d'Ivoire"

    Note: Changing to "Raw output" is not always possible. Terms field for example, will then output the term id, and not the term name :)

Production build 0.69.0 2024