Skip to content

Fix the LOWERCASE_HEX docs: it also applies to control characters - #321

Merged
ibireme merged 1 commit into
ibireme:masterfrom
emincan2000:lowercase-hex-doc
Oct 30, 2026
Merged

ibireme merged 1 commit into
ibireme:masterfrom
emincan2000:lowercase-hex-doc

Conversation

@emincan2000

Copy link
Copy Markdown
Contributor

The docs for YYJSON_WRITE_LOWERCASE_HEX say it's only effective together with YYJSON_WRITE_ESCAPE_UNICODE, but the writer uses the lowercase table for every \u escape it writes. So it already works on its own for control characters, writing "\x1f" with just LOWERCASE_HEX gives \u001f instead of \u001F. That's also what #264 had in mind since it mentions the control char case.

This updates the comment in yyjson.h and the section in doc/API.md. I kept the \u001f example out of the header because a valid looking \u escape in a C comment can upset some old compilers, so it's only in API.md.

The writer uses the lowercase hex table for every \uXXXX escape it
writes, so escaped control characters come out lowercase even without
ESCAPE_UNICODE. The docs said the flag only works together with
ESCAPE_UNICODE.
@ibireme
ibireme merged commit ebb8d7e into ibireme:master Oct 30, 2026
50 checks passed
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.40%. Comparing base (2c9c76a) to head (7ed1758).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #321   +/-   ##
=======================================
  Coverage   98.40%   98.40%           
=======================================
  Files           2        2           
  Lines        7844     7844           
=======================================
  Hits         7719     7719           
  Misses        125      125           
Flag Coverage Δ
unittests 98.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants