[Solved] String Variable Unescape function bug

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

[Solved] String Variable Unescape function bug

Postby clyne » Sun Jun 10, 2018 1:45 pm

Hello,
I am working with escape-ed strings, and there seems to be an issue with parsing new lines (although I haven't tested with other escaped characters).
A colleague has also been able to reproduce this issue.

Code: Select all
var text="Foo\nFoo\nBar\nFoo\nBar"
//tested with '\r\n' and '\n'
Label1.Text = text.Unescape

Produces the correct result of:
Foo
Foo
Bar
Foo
Bar


Code: Select all
var text="FooBar\nFoo\nBar\nFoo\nBar"
Label1.Text = text.Unescape

produces the incorrect result of:
FooBar
Foo Bar
Foo Bar


Through further testing, it seems like the length of text before the first escaped character must be longer than any further text between escaped characters.

WD 6.0.4 Free
W10 Pro v1709 build 16299.248
Last edited by clyne on Tue Jun 12, 2018 2:24 pm, edited 1 time in total.
clyne
 
Posts: 4
Joined: Thu May 12, 2016 11:02 pm

Re: String Variable Unescape function bug

Postby Thomas Mrozek » Tue Jun 12, 2018 10:10 am

Hi clyne,

thank you for reporting this. I forward this to our development.

As a workaround please avoid using the "unescape" member.

E.g.
Code: Select all
WDLabelText(1,text)


cheers
Thomas
Thomas Mrozek
Technical Support Engineer
User avatar
Thomas Mrozek
 
Posts: 105
Joined: Mon Apr 20, 2009 11:08 am

Re: String Variable Unescape function bug

Postby Thomas Mrozek » Tue Jun 12, 2018 1:45 pm

Hi,

I have to correct myself.

The "unescape" member is working correctly. The issue is the usage of "\n" and the WD label. The Label widget is developed for 1 line texts. When the label widget is in auto resize mode the 1st entry is defining the size of the label and all following lines will use this size, "\n" will just produce a space. You will see that everything is just 1 line if you turn off auto resize mode and drag the label size long.
You can cheat the new line by using "<br>", but this can raise different issues, depending on what you want to do.
Maybe a "read-only" textbox can be an alternative?

cheers
Thomas
Thomas Mrozek
Technical Support Engineer
User avatar
Thomas Mrozek
 
Posts: 105
Joined: Mon Apr 20, 2009 11:08 am

Re: String Variable Unescape function bug

Postby clyne » Tue Jun 12, 2018 2:24 pm

Hello,

Good to know!
The end result for the unescaped string will be a text asset in PB.
The label was just a useful way to debug & test the other end of the TCP connection.

The Text Box does exactly what I need! Thanks
clyne
 
Posts: 4
Joined: Thu May 12, 2016 11:02 pm


Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 4 guests