Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle surrogate pairs as single char in string functions #174

Merged
merged 1 commit into from
Mar 21, 2018

Conversation

andrew-coleman
Copy link
Member

Codepoints outside the Basic Multilingual Plane are represented in Javascript by 2 characters (surrogate pair). This causes $length('💩') to return 2 rather than the expected 1.

$length, $substring and $pad have been fixed to produce the expected results for strings that contain these codepoints.

Resolves #156

@coveralls
Copy link

coveralls commented Mar 21, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling e6ff177 on surrogate_pairs into 2010889 on master.

@mattbaileyuk mattbaileyuk merged commit c020650 into master Mar 21, 2018
@mattbaileyuk mattbaileyuk deleted the surrogate_pairs branch March 21, 2018 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$length and other string functions return misleading results for UTF-16 surrogate pairs
3 participants