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

Add utility VIs for encoding and decoding data as strings to prevent unintended filtering #57

Open
Tom-McQuillan opened this issue Feb 3, 2025 · 2 comments

Comments

@Tom-McQuillan
Copy link
Collaborator

Tom-McQuillan commented Feb 3, 2025

Suggestion by @HunterJKI
I had a use case where I wanted to send a path as a state machine argument, and for ...reasons... the files had # symbols in them. These get truncated out by the comment filter, and I don't think there is a way around it short of writing a specific character replacer.

Image

Here is an example with specific url style encoding, this works but would be nice to have a general solution with escape characters.

Image

Note from @drjdpowell
A possible general solution is to use base64url encoding for the parameter. This avoids all possible control characters except '_' and '-'. I have base64url functions in JSONtext if anyone wants to copy them.

If fact, one should be able to flatten any datatype and then base64url encode, and thus be able to send any datatype as a parameter, not just paths.

@HunterJKI
Copy link

HunterJKI commented Feb 4, 2025

Note: This vilib function may have some related help.

Image

@nevstop
Copy link

nevstop commented Feb 5, 2025

Path in one case. The string argument format does not support using cluster/reference/.. as arguments. Here is what I implemented in CSM. I recommend creating a pair of VIs to convert between variant and visible hex string. This way, all data types can be supported. Hope it could help.

Usage:
Image

Convert Data to HexStr.vi

Image

Convert HexStr to Data.vim
Image
Image

Example:
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants