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

[SR-13403] UTF-8 decoding truncates replacement character #55844

Closed
belkadan opened this issue Aug 15, 2020 · 2 comments
Closed

[SR-13403] UTF-8 decoding truncates replacement character #55844

belkadan opened this issue Aug 15, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@belkadan
Copy link
Contributor

Previous ID SR-13403
Radar None
Original Reporter @belkadan
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift 5.2.4

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

md5: 3cc506ee44670166398aa02de6d2828e

duplicates:

  • SR-8111 Weird issue when printing String with unicode character

Issue Description:

% xcrun swift                                           
impWelcome to Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53).
Type :help for assistance.
  1> String(decoding: [0x80], as: UTF8.self)
$R0: String = "\u{ef}"

What's ef? Turns out it's a truncated form of the replacement character U+FFFD, which encodes as EF BF BD in UTF-8. I'm not sure why it's getting truncated, though.

(Aside: Why am I using init(decoding:as:)? Because Foundation's decoding just fails on bad code units rather than falling back to a replacement character.)

@poya
Copy link
Contributor

poya commented Aug 16, 2020

Looks like duplicate of lldb formatting issue SR-8111. Should be resolved in master and 5.3

@belkadan
Copy link
Contributor Author

I didn't even think about the fact that both Playgrounds and the REPL run through LLDB. Thanks, Martin!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants