pict icon indicating copy to clipboard operation
pict copied to clipboard

Fix Japanese Kanji character handling in constraints

Open Copilot opened this issue 9 months ago • 0 comments

Issue

Japanese Kanji character "予" was causing exceptions in constraint expressions:

  • When used in conditions like if [予] = "Hoge", it would throw: Input Error: Non-special character was escaped
  • When used as a single character parameter name: if [予] = "Hoge" then [Foo] = "Bar", it would throw: Input Error: Misplaced THEN keyword or missing logical operator

Root Cause

Two separate issues were identified:

  1. The comparison in the getString function was mistakenly treating the Kanji character as a backslash (special character marker)
  2. Some constraint expressions were missing the required semicolon terminator

Fix

  1. Modified the special character detection logic in getString function to use an explicit backslash literal comparison (L'\\') instead of the macro
  2. Added test cases to verify the fix works correctly:
    • test/japanese_kanji.txt - Tests a Japanese Kanji character in parameter names and constraints
    • test/special_chars.txt - Tests proper handling of escaped quotes

This change ensures that Unicode characters like Japanese Kanji are handled correctly in parameter names and constraint expressions.

Fixes #74.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar May 19 '25 17:05 Copilot