1. Aniesh Nanu
  2. PowerBuilder
  3. Monday, 11 March 2019 08:33 AM UTC

I would like the experts, to confirm if below case is a PB2017 bug.

Preceding and succeeding character Char(26) ('') got removed when using Trim function.
We have migrated from PB12.5 to PB2017R3(Build 1880). When we use Trim function to an encrypted string it removes a character, Char(26) ('').
for example, Trim("Password") resulted as "Password".
The same resulting correctly in PB12.5; Trim("Password") resulted as "Password".

To Reproduce:

Get the result of Trim("Password") in a variable. we can see the issue.
The character "" is the result of Char PowerScript function.
Char(26).

Remarks:
Ours is a standard window based business application.
we use,
Appeon PowerBuilder Standard Edition
Version 2017 R3 Build 1880

As of now, we are changing the code to avoid using 'Trim' function for encrypted strings.

Brad Mettee Accepted Answer Pending Moderation
  1. Monday, 11 March 2019 13:18 PM UTC
  2. PowerBuilder
  3. # 1

Since trim also removes several other characters that might end up in an encrypted string (potentially at the end), you shouldn't have been using it in the first place. An encrypted string is meant to be used EXACTLY as created, with no changes to it afterwards.

Char(26) (Ctrl-Z) is frequently the EOF marker for text files, and should be removed with trim as it's not a standard displayable text character (some font families don't have it defined at all).

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 11 March 2019 14:27 PM UTC
  2. PowerBuilder
  3. # 2

I agree with Brad, you shouldn't be using Trim on an encrypted string. Anything you do to modify the encrypted string will prevent it from being decrypted later.

Comment
  1. Chris Pollach @Appeon
  2. Monday, 11 March 2019 18:49 PM UTC
Hi Roland ...

FWIW: I agree with you & Brad 100% - leave it alone ... LOL!

Regards ... Chris
  1. Helpful
  1. Aniesh Nanu
  2. Tuesday, 12 March 2019 01:36 AM UTC
But how does it work correctly in PB12.5?

PowerBuilder Classic Version 12.5.2 Build 5006
  1. Helpful
  1. Roland Smith
  2. Tuesday, 12 March 2019 12:32 PM UTC
Pure luck?

This reminds me of an old joke...

Patient: Doctor, my arm hurts when I do this (moves arm).

Doctor: Well don't do that.
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Monday, 11 March 2019 14:22 PM UTC
  2. PowerBuilder
  3. # 3

trim( string) should only trim off spaces.

trim(string, true) should trim off all types of whitespace - although char(26) is not listed as one of the characters that would be removed.

you should submit this as a bug

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.