iefieldkit icon indicating copy to clipboard operation
iefieldkit copied to clipboard

General: Handling of special characters in locals

Open luizaandrade opened this issue 4 years ago • 3 comments

Luiza: Should probably find a way to keep these (special characters) in the future. Ben: Agree. At least it would be better to have a good list of what can and can't be handled well and what code conventions are needed to handle what characters.

_Originally posted by @luizaandrade in https://github.com/render_node/MDIzOlB1bGxSZXF1ZXN0UmV2aWV3VGhyZWFkMjU5MjAzMzAxOnYy/pull_request_review_threads/discussion

luizaandrade avatar Apr 28 '20 15:04 luizaandrade

Add to utility functions

kbjarkefur avatar Jul 23 '20 18:07 kbjarkefur

@kbjarkefur here is what I typically do, for reference:

    // Clean up common characters
    foreach character in , . < > / [ ] | & ! ^ + - : = ( ) # "{" "}" "`" "'" {
      replace v1 = subinstr(v1,"`character'"," ",.)
    }
      replace v1 = subinstr(v1, char(34), "", .) // Remove " sign
      replace v1 = subinstr(v1, char(96), "", .) // Remove ` sign
      replace v1 = subinstr(v1, char(36), "", .) // Remove $ sign
      replace v1 = subinstr(v1, char(10), "", .) // Remove line end

bbdaniels avatar Jul 23 '20 18:07 bbdaniels

@bbdaniels here is how you can modify locals without interpret them:

*Do not interpret macros
local line : subinstr local line "\$"  "\\$"
local line : subinstr local line "\`"  "\\`"

This code snippet comes from here.

kbjarkefur avatar Jul 23 '20 19:07 kbjarkefur