Skip to content

v1.0.2 - Save file corruption fix

Choose a tag to compare

@msarson msarson released this 14 May 19:56
· 33 commits to main since this release

Fixed

  • Saving silently corrupted any file containing <, backslashes, tabs, or non-ASCII characters (#1).

    WebView2.ExecuteScriptAsync returns the script result as a JSON-encoded string. Chromium escapes < as its Unicode escape sequence (HTML-safe embedding), single backslashes as doubled backslashes, and any non-ASCII character as its \uXXXX form. Both save paths (GetEditorContentAsync and GetTabContentFromJs) hand-rolled a decoder that only handled \n, \r, and \" — every other escape passed through as the literal characters of the escape and was written to disk.

    As a result:

    • Embedded HTML like <style> was saved with < replaced by a six-character Unicode escape.
    • Single backslashes in saved content were doubled.
    • Any literal backslash-n (e.g. inside a Windows path) was converted to a real newline, splitting the content across two lines.
    • Smart quotes, accented letters, em-dashes, emoji and other non-ASCII characters were broken.

    Replaced both decoders with a proper JSON string decoder (DecodeJsonString) that handles the full JSON escape set including \uXXXX surrogate pairs.

  • Repaired README content previously damaged by this same bug — restored single backslashes in Windows paths, removed Unicode-escape leftovers from XML examples, and rejoined a path that had been split across two lines.

Installation

  1. Extract the zip into {CLARION_PATH}\accessory\addins\MarkdownEditor\ (overwriting v1.0.1 files).
  2. Unblock the extracted files — right-click each .dll → Properties → Unblock, or run Get-ChildItem "<install path>" -Recurse | Unblock-File in PowerShell.
  3. Restart Clarion.

Full Changelog: v1.0.1...v1.0.2