← Back to release summary

Write `image/svg+xml` content in UTF-8 format on Windows.

Category
Miscellaneous
Type
No developer-visible change
Status
Enabled by default (Chrome 128)
Intent stage
None

Summary

On Windows, popular native apps [1] use UTF-8 format to read/write SVG images from/to clipboard. Proposal is to switch to UTF-8 on Windows while writing `image/svg+xml` format to the clipboard. This is similar to the HTML format where we use UTF-8 on Windows. When SVG image content is read from the clipboard, Chromium converts it into UTF-16. Alternative considered It was attempted to add a BOM character to the UTF-16LE encoded SVG image content, but the sampled native apps [1] were unable to parse the images correctly. [1] Here is an inventory of all the sampled native apps that read/write `image/svg+xml` format: https://docs.google.com/document/d/1ULlihA0FOJOqcyD9MgzLZrAbk0uTQPJqDPuPJ2aiuS4/edit?usp=sharing [2] https://learn.microsoft.com/en-us/windows/win32/dataxchg/html-clipboard-format#:~:text=The%20only%20character%20set%20supported%20by%20the%20clipboard%20is%20Unicode%20(UTF%2D8).

Motivation

In M124, support for `image/svg+xml` native format was shipped in async clipboard APIs. In Chromium, SVG image is written to the clipboard in UTF-16 format on Windows. Many popular apps [1] on Windows use UTF-8 encoding to read/write SVG images from/to clipboard. Hence, when a user tries to copy SVG images from Chromium and paste into one of these native apps, the image will be parsed incorrectly and will not render after paste. This can be reproduced by visiting https://webdbg.com/test/svg/ or https://heathered-spotty-fin.glitch.me/ to copy `image/svg+xml` to the clipboard and paste it into native Word. The paste succeeds but the image doesn't render because of the invalid encoding. Proposal is to switch to UTF-8 on Windows while writing `image/svg+xml` format to the clipboard. This is similar to the HTML format where we use UTF-8 on Windows too. [2] [1] Here is an inventory of all the sampled native apps that read/write `image/svg+xml` format: https://docs.google.com/document/d/1ULlihA0FOJOqcyD9MgzLZrAbk0uTQPJqDPuPJ2aiuS4/edit?usp=sharing [2] https://learn.microsoft.com/en-us/windows/win32/dataxchg/html-clipboard-format#:~:text=The%20only%20character%20set%20supported%20by%20the%20clipboard%20is%20Unicode%20(UTF%2D8).

Standards & signals

Docs: https://docs.google.com/document/d/1ULlihA0FOJOqcyD9MgzLZrAbk0uTQPJqDPuPJ2aiuS4/edit?usp=sharing

Samples: https://webdbg.com/test/svg

View on chromestatus.com