ios smart quotes replacing normal double quotes when a json file is loaded with the file picker
Description
Related issue: https://github.com/dotnet/maui/issues/22127
Tried workaround:
Microsoft.Maui.Handlers.EditorHandler.Mapper.AppendToMapping("Smart", (h, v) =>
{
h.PlatformView.SmartQuotesType = UIKit.UITextSmartQuotesType.No;
h.PlatformView.SmartDashesType = UIKit.UITextSmartDashesType.No;
h.PlatformView.SmartInsertDeleteType = UIKit.UITextSmartInsertDeleteType.No;
});
Steps to Reproduce
In a maui ios app, trigger the following code. When the picker appears, select any non empty json file.
If it works as expected, a breakpoint on line "json = json.Trim...." should not trigger.
var options = new PickOptions
{
PickerTitle = "Select a file to import",
FileTypes = new (
new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.iOS, new [] { "public.json" } }, //(string) UIType.Json: used in maui, but unavailable otherwise ?!
}),
};
var fileData = await FilePicker.PickAsync(options);
if (fileData != null)
{
AppSettingsFileName = fileData.FileName;
await using var stream = await fileData.OpenReadAsync();
using var reader = new StreamReader(stream);
var json = reader.ReadToEnd();
//Workaround this issue
if (json.Contains('«') || json.Contains('“'))
{
json = json.Trim('\0')
//iPad
.Replace((char)0xA0, ' ')
.Replace("« ", "\"")
.Replace(" »", "\"")
//iPhone
.Replace("“", "\"")
.Replace("”", "\"")
;
}
}
Link to public reproduction project repository
No response
Version with bug
8.0.91 SR9.1
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
All versions
Did you find any workaround?
Yes see above.
Relevant log output
No response
We've found some similar issues:
- #22127 , similarity score: 84%
- #18220 , similarity score: 81%
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
Note: You can give me feedback by 👍 or 👎 this comment.
Could you provide us with sample project so that we can investigate it further? Looking forward to your reply!
Invalid issue. Caused by the "<Editor />" widget which replaces quotes in a double way binding.