Skip to content

remove support for UTF-16 and UTF-32 - #335

Merged
Herringway merged 1 commit into
dlang-community:masterfrom
Herringway:utf8only
Nov 8, 2025
Merged

Herringway merged 1 commit into
dlang-community:masterfrom
Herringway:utf8only

Conversation

@Herringway

Copy link
Copy Markdown
Member

UTF-16 and UTF-32 are so rarely used that the YAML devs are considering removing them from the spec entirely. For those who DO need this functionality, std.utf.toUTF8/toUTF16/toUTF32 covers it just as efficiently - we were eagerly converting under the hood anyways.

Notable public interface changes here:

  • Loader.fromBuffer is now a deprecated alias of Loader.fromString as they are effectively equivalent now.
    • This means void[] or ubyte[] cannot directly be loaded anymore. I've only seen one public codebase even using this functionality, and it had to cast strings to ubyte[] to do it.
  • Reader.encoding removed. Unsure if this was ever used.
  • Token.encoding removed. ditto.
  • toUTF8() was removed. Why was this public in the first place...?
  • Emitter no longer has a CharType template parameter (only supports UTF-8)

Pros:

  • We can drop our only dependency
  • Simplified reading/writing code
  • Less document copying (not part of this PR)
  • Small but noticeable reduction to compile time

Cons:

  • Breaks backwards compatibility, but hopefully not in a way that actually impacts anyone

@Herringway

Copy link
Copy Markdown
Member Author

After nearly a year with no concerns raised, it seems like a good time to merge and see what happens.

@Herringway
Herringway merged commit b69dff3 into dlang-community:master Nov 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant