-
Notifications
You must be signed in to change notification settings - Fork 367
Double quote gets transformed. #45
Comments
I dug a deep into this problem and to me (unexperienced Swift developer) it seems that the problem is the Smart Quotes feature that Mac has enabled by default. Disabling it in the System Preferences fixes this issue. I tried to code something to fix this without needing to disable the Smart Quotes feature, but ran into a few problems: There's a flag that can be used to disable this behavior programmatically, called One thing that worked was to use the var string = "" {
didSet {
// using two replacingOccurrences since both quotes are actually different from one another
self.textView.string = string.replacingOccurrences(of: "“", with: "\"").replacingOccurrences(of: "”", with: "\"")
self.copyButton.stringContent = string
}
} Note: I forgot to mention, but this 'solution' will not work for French quote symbols ( « » ) nor German ones ( „ “ ) :/ If anyone got any ideias on how to solve this problem more elegantly, let me know, I'll gladly create the PR fixing this 😄 |
@jacola @DanielSouzaBertoldi Thank you for your issue! I certainly think it's a serious problem too. I want to fix it. But I can't reproduce the problem. Could you please let me know your keyboard settings and how it is occured? |
@ObuchiYuki my keyboard layout is Brazilian - ABNT2 If we copy and paste a json then it's formatted properly, but if we type a json then the Mac replaces the quotes for the slanted version of it, as can be seen in my GIF below. |
I have standard keyboard settings as well for an English OS in Japanese region. As @DanielSouzaBertoldi mentioned, this setting should stop the issue from having, but it's true by default. |
I was able to reproduce and fix the bug. Thanks for your help! |
@DanielSouzaBertoldi @jacola Thank you for your support! I can fix this bug! You can get fixed version on |
Copy and paste works fine, but when typing double quotes into the JSON formatter, macOS transforms them to /slanted/ quotes.
{ "test": "darn" }
becomes{ “test”: “darn” }
resulting in invalid JSON.The text was updated successfully, but these errors were encountered: