Convert input handling based on CCSID scenarios#2556
Convert input handling based on CCSID scenarios#2556worksofliam wants to merge 8 commits intomasterfrom
Conversation
…arios. Signed-off-by: worksofliam <mrliamallan@live.co.uk>
|
👋 A new build is available for this PR based on 79e49f1. |
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
| Tools.qualifyPath(inAmerican(file.library), inAmerican(file.name), inAmerican(member), asp, true), | ||
| Tools.qualifyPath(inAmerican(file.library), inAmerican(file.name), inAmerican(member), undefined, true) | ||
| Tools.qualifyPath(forSystem(file.library), forSystem(file.name), forSystem(member), asp, localVariants), | ||
| Tools.qualifyPath(fromSystem(file.library), fromSystem(file.name), fromSystem(member), undefined, localVariants) |
There was a problem hiding this comment.
It used to be inAmerican, so I think this should be forSystem here.
| Tools.qualifyPath(fromSystem(file.library), fromSystem(file.name), fromSystem(member), undefined, localVariants) | |
| Tools.qualifyPath(fromSystem(file.library), forSystem(file.name), forSystem(member), undefined, localVariants) |
| sysNameInAmerican(string: string, enabled: boolean = true) { | ||
| if (enabled) { | ||
| const fromChars = this.variantChars.local; | ||
| const toChars = this.variantChars.american; | ||
|
|
||
| let result = string; | ||
| let result = string; | ||
|
|
||
| for (let i = 0; i < fromChars.length; i++) { | ||
| result = result.replace(new RegExp(`[${fromChars[i]}]`, `g`), toChars[i]); | ||
| }; | ||
| for (let i = 0; i < fromChars.length; i++) { | ||
| result = result.replace(new RegExp(`[${fromChars[i]}]`, `g`), toChars[i]); | ||
| }; | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| return result | ||
| return string; | ||
| } |
There was a problem hiding this comment.
The logic behind the enabled parameter is unclear or would need to be redefined. Looking at all the references in the code, it's always this class' qsysPosixPathsRequireTranslation field that is used.
Here is a suggestion: make that second parameter optional, and when it's true, consider qsysPosixPathsRequireTranslation value. Then in the places where the method is called with the second parameter, pass ifNeeded as true:
| sysNameInAmerican(string: string, enabled: boolean = true) { | |
| if (enabled) { | |
| const fromChars = this.variantChars.local; | |
| const toChars = this.variantChars.american; | |
| let result = string; | |
| let result = string; | |
| for (let i = 0; i < fromChars.length; i++) { | |
| result = result.replace(new RegExp(`[${fromChars[i]}]`, `g`), toChars[i]); | |
| }; | |
| for (let i = 0; i < fromChars.length; i++) { | |
| result = result.replace(new RegExp(`[${fromChars[i]}]`, `g`), toChars[i]); | |
| }; | |
| return result; | |
| } | |
| return result | |
| return string; | |
| } | |
| sysNameInAmerican(string: string, ifNeeded?: boolean) { | |
| if (!ifNeeded || this.qsysPosixPathsRequireTranslation) { | |
| const fromChars = this.variantChars.local; | |
| const toChars = this.variantChars.american; | |
| let result = string; | |
| for (let i = 0; i < fromChars.length; i++) { | |
| result = result.replace(new RegExp(`[${fromChars[i]}]`, `g`), toChars[i]); | |
| }; | |
| return result; | |
| } | |
| return string; | |
| } |
sebjulliand
left a comment
There was a problem hiding this comment.
@worksofliam I made an initial code review. I'll see how it goes at runtime.
I left a few comments for some changes. Thanks!





Enhance input conversion logic to account for CCSID in various contexts, ensuring proper translation for system commands and SQL statements. Adjustments made to improve path handling and user feedback during checks.
Fixes #2519
How to test