Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support utf-8 strings in configuration files #36

Closed
end2endzone opened this issue Dec 1, 2019 · 7 comments
Closed

Support utf-8 strings in configuration files #36

end2endzone opened this issue Dec 1, 2019 · 7 comments
Labels
bug Something isn't working

Comments

@end2endzone
Copy link
Owner

Parsing from an xml configuration file encoded in utf-8 does not seems to be working as expected.

For example, the following menu is not displayed properly:

    <menu name="_Ψ_" description="test for psi letter" />

The action does not support utf-8 strings. For example, the following prompt message is not displayed as expected:

    <menu name="test" description="test for copyright and omega characters">
      <actions>
        <prompt name="myarguments" title="z©z" default="Hugh _Ω_ Jass" />
      </actions>
    </menu>
@end2endzone end2endzone added the bug Something isn't working label Dec 1, 2019
@end2endzone
Copy link
Owner Author

May be related to issue #9.

@end2endzone
Copy link
Owner Author

Sample file:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <shell>
    <menu separator="true" />
    <menu name="issue36">
      <menu name="do a prompt" description="test for copyright and omega characters">
        <actions>
          <prompt name="myarguments" title="z©z" default="Hugh _Ω_ Jass" />
        </actions>
      </menu>
      <menu name="psi letter: _Ψ_" description="test for psi letter" />
      <menu name="copyright letter: z©z" description="" />
    </menu>
    <menu separator="true" />
  </shell>
</root>

issue36.txt

@end2endzone
Copy link
Owner Author

end2endzone commented Feb 16, 2020

ActionClipboard and ActionPrompt classes are converted to support utf8 data in commit 5b6f355.

The ActionExecute, ActionFile and ActionOpen classes remains to be converted. This will probably require RapidAssist to support utf8.

@end2endzone
Copy link
Owner Author

The following functions also need to be converted to their windows unicode format counterpart:

  • CContextMenu::GetCommandString()
  • CContextMenu::BuildMenuTree() for MENUITEMINFOW and InsertMenuItemW()
  • CContextMenu::GetCommandString()

@end2endzone
Copy link
Owner Author

I think the best strategy is to "property" convert to utf-8 when a configuration file is read. Then, in windows functions like CContextMenu::GetCommandString(), we always convert from utf-8 to windows unicode (utf-16). This would be a better approach since all the ansi/ascii/utf-8 detection would be in the same location, could be unit tested. It also uniformalize the code in the shell extension.

end2endzone added a commit that referenced this issue Feb 23, 2020
…xtMenu::BuildMenuTree() to use unicode. Issue #36."

This reverts commit 5b6f355 and 3019417.
end2endzone added a commit that referenced this issue Feb 24, 2020
@end2endzone
Copy link
Owner Author

end2endzone commented Apr 9, 2020

Properties such as selection.path should be updated to clearly identify if the encoding used is ansi or utf8 as this can clearly affect a command. For example:

<file path="${env.USERPROFILE}\myapp.ini">selection=${selection.path}</file>

This could also be identified as a breaking change in CHANGES file.

@end2endzone
Copy link
Owner Author

The issue about <file> action has been moved to issue #44. The properties such as selection.path do need to be documented as utf-8 encoded but it is not a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant