Skip to main content
Version: 1.1.0

enhancedEncodeURIComponent

@spartanfx/react v1.1.0


@spartanfx/react / index / enhancedEncodeURIComponent

Function: enhancedEncodeURIComponent()

function enhancedEncodeURIComponent(str): string;

Percent-encodes a string while preserving accented Latin-1 letters and =.

Parameters

str

string

The raw string to encode.

Returns

string

The encoded string, safe for use in a URL component.

Remarks

Unlike the native encodeURIComponent, this keeps Àÿ (Latin-1 Supplement, code points 192–255) and = literal, which SharePoint REST $filter expressions expect. Every other character outside [A-Za-z0-9] is %-escaped using the upper-case hex of its code point.

Example

enhancedEncodeURIComponent("Café = ½"); // "Café%20=%20%BD"