Skip to content

Export test classes as UTF-8 with BOM and detect encoding on import - #94

Merged
josef-poetzl merged 1 commit into
devfrom
feature/core-utf8-test-class-files
Nov 17, 2026
Merged

josef-poetzl merged 1 commit into
devfrom
feature/core-utf8-test-class-files

Conversation

@josef-poetzl

Copy link
Copy Markdown
Member

Summary

VBComponent.Export and VBComponents.Import always use the ANSI code page. The core now converts the files:

  • Export: .cls/.bas files are rewritten as UTF-8 with BOM and CRLF (like msaccess-vcs). New setting ImportExportEncoding (Utf8Bom (default) | Ansi) in TestSuiteUserSettings, the COM interface IUserSettings (added at the end) and the VBE add-in property grid. Access documents (SaveAsText) are unchanged.
  • Import: independent of the setting, the encoding is detected (UTF-8 with BOM, valid UTF-8 without BOM, otherwise ANSI). An ANSI copy with CRLF is imported from a temporary folder. If any file contains characters not available in the ANSI code page, nothing is imported and UnsupportedSourceCharactersException lists the files.
  • New VbaSourceFile in Common.VBIDETools (logic taken from the MCP server's TestModuleSourceFile).
  • VBE add-in: UserSettings.Save unloads TestSuiteUserSettings.Current, so TestClassManager uses changed settings without restart.

Behavior change: exported test classes are UTF-8 with BOM instead of ANSI (noted for the release notes).

Tests

  • New VbaSourceFileTests (TestGeneratorTests, code page 1252): decode, rejection, CRLF, ANSI copy, export conversion.
  • MSBuild (AzureCI) of the core and VBE add-in solutions, VSTest: 207 passed, 2 skipped. MCP server solution built against the new core: 141/141 passed.
  • Not tested manually in Access yet.

Follow-ups

  • Access add-in settings form: add ImportExportEncoding.
  • MCP server: use VbaSourceFile from the core instead of its own conversion logic.

VBComponent.Export and VBComponents.Import always use the ANSI code
page. The core now rewrites exported .cls/.bas files as UTF-8 with BOM
(new setting ImportExportEncoding: Utf8Bom (default) or Ansi) and
imports an ANSI copy with CRLF of each source file. The import detects
UTF-8 with or without BOM, otherwise ANSI, and rejects all files if one
contains characters not available in the ANSI code page.
@josef-poetzl
josef-poetzl merged commit f26b744 into dev Nov 17, 2026
1 check passed
@josef-poetzl
josef-poetzl deleted the feature/core-utf8-test-class-files branch November 17, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant