Open sirrahd opened 6 years ago
Thanks Daniel. I did some edge case testing just now on this and found this doesn't handle " and \ characters well, need to escape them to make JSON.parse happy. I will push an update today with these fixes and your requested changes.
Just pushed an update that addresses your feedback and fixes the " and \ issues.
This change fixes an issue where the Datetime Format GUI fails to load with the error 'Failed to convert locale string to UTF8: Invalid byte sequence in conversion input' if unicode characters are entered in any of the format strings.
Date().toLocaleFormat(format) only accepts ascii characters in the format string. This change works around that limitation by escaping non-ascii characters in the format string before passing the string to toLocaleFormat(), then escaping the result in case non-ascii characters are in the localized string, and finally unescaping the resulting string by passing it to JSON.parse.