Is your issue REALLY a bug?
Is there an existing issue for this?
Is this issue related to iced?
What happened?
On macOS, writing non-ASCII text through iced::clipboard::write corrupts it on the system clipboard.
Minimal example:
iced::clipboard::write::<Message>("→".to_owned())
After pasting into another application:
This is a byte-for-byte encoding signature: → is UTF-8 E2 86 92, while interpreting those three bytes individually as MacRoman produces ‚Üí.
I encountered this in a terminal emulator in two independent user-facing flows:
- Copying selected terminal text with a copy keybind.
- Handling an OSC 52 clipboard-store request.
Both flows produce the correct Rust String and converge on iced::clipboard::write, and both exhibit the same corruption on macOS. Selection extraction tests already verify Unicode scalars, wide characters, and combining characters before the Iced clipboard boundary.
Relevant resolved dependency versions from the application using Iced 0.14:
iced 0.14.0
iced_winit 0.14.0
window_clipboard 0.5.1
clipboard_macos 0.1.1
objc2 0.5.2 (through clipboard_macos)
objc2-foundation 0.2.2 (through clipboard_macos)
The current macOS path is:
iced::clipboard::write
-> iced_winit::Clipboard::write
-> window_clipboard::ClipboardProvider::write
-> clipboard_macos::Clipboard::write
An application-level workaround is to bypass that writer on macOS and write an NSString explicitly as NSPasteboardTypeString:
let pasteboard = NSPasteboard::generalPasteboard();
pasteboard.clearContents();
let text = NSString::from_str(text);
let string_type = unsafe { NSPasteboardTypeString };
pasteboard.setString_forType(&text, string_type);
This workaround type-checks for aarch64-apple-darwin against objc2 0.6.4 and objc2-app-kit / objc2-foundation 0.3.2. I am including it to narrow the likely boundary, not to assert the precise upstream fix.
What is the expected behavior?
The clipboard must preserve the Unicode string exactly. Writing → should paste as →, and other non-ASCII characters should round-trip unchanged.
Version
crates.io release (iced 0.14.0)
Operating System
macOS
Do you have any log output?
There is no relevant log output; the clipboard operation reports no error.
Is your issue REALLY a bug?
Is there an existing issue for this?
iced-rs/iced, as well as issues inhecrj/window_clipboard, using macOS, clipboard, Unicode, non-ASCII, encoding, andclipboard_macosterms. I found no matching report.Is this issue related to iced?
String, and the corruption happens when it is written through Iced's macOS clipboard path.What happened?
On macOS, writing non-ASCII text through
iced::clipboard::writecorrupts it on the system clipboard.Minimal example:
After pasting into another application:
This is a byte-for-byte encoding signature:
→is UTF-8E2 86 92, while interpreting those three bytes individually as MacRoman produces‚Üí.I encountered this in a terminal emulator in two independent user-facing flows:
Both flows produce the correct Rust
Stringand converge oniced::clipboard::write, and both exhibit the same corruption on macOS. Selection extraction tests already verify Unicode scalars, wide characters, and combining characters before the Iced clipboard boundary.Relevant resolved dependency versions from the application using Iced 0.14:
The current macOS path is:
An application-level workaround is to bypass that writer on macOS and write an
NSStringexplicitly asNSPasteboardTypeString:This workaround type-checks for
aarch64-apple-darwinagainstobjc20.6.4 andobjc2-app-kit/objc2-foundation0.3.2. I am including it to narrow the likely boundary, not to assert the precise upstream fix.What is the expected behavior?
The clipboard must preserve the Unicode string exactly. Writing
→should paste as→, and other non-ASCII characters should round-trip unchanged.Version
crates.io release (
iced0.14.0)Operating System
macOS
Do you have any log output?
There is no relevant log output; the clipboard operation reports no error.