Skip to content

HttpUtility.JavaScriptStringEncode single quote behavior does not match documentation #100248

Open
@ogjkoch

Description

@ogjkoch

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The documentation for HttpUtility.JavaScriptStringEncode states that the single quote character (') will be escaped as \'.

However, it gets escaped as \u0027.

Double quote is escaped as the documentation describes.

Expected Behavior

Expected that HttpUtility.JavaScriptStringEncode functions as documented.

Steps To Reproduce

Pass a string containing a single quote character (') to HttpUtility.JavaScriptStringEncode.

Here is a .NET fiddle displaying this behavior.

Exceptions (if any)

No response

.NET Version

8.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.NetdocumentationDocumentation bug or enhancement, does not impact product or test codehelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions