Short story:
When using the SUBSTITUTE function in the expression editor with characters to replace like ^ and {, it fails to replace them. It consistently pre-pends the text to the text variable, leaving ALL instances of the replacement character untouched.
Are these extended characters some form of escape characters I missed on tulip’s documentation?
Otherwise, what is causing this behavior, and is there a way to consistently replace characters like ^ and {?
Long story:
I am attempting to use the ZPL label display widget, but the widget is unable to display my selected ZPL text. I determined that this is because the HTTP call to it does not properly percent encode the HTTP request properly (This does not appear to be a tulip specific problem. The same HTTP request through my browser does the same thing for requests longer than a certain amount) and the API used in the widget does not like it. When I pre-encode the extended characters to their proper value, I am able to retrieve an image properly through the API. Given this, I decided to pre-encode the ZPL text before it hits the widget and will format correctly. That brings me to my problem: The characters I need to encode do not seem to be able to be easily replaced. I need to be able to consistently replace most of the characters in the image below.
For reference, here is a label that fails to properly encode in the widget’s API call.
^XA^LL1219^PW812^POI^LH5,5^CI28^BY3^FO0,0,0^GB801,1207,2,B,0^FS^FO40,25,0^FB121,1,0,C,0^A0N,203,203^FDP^FS^FO203,0,0^GB0,203,3,B,0^FS^FO481,38,0^GB243,116,2,B,0^FS^FO493,50,0^FB219,4,0,C,0^A0N,23,23^FDPRIORITY MAIL\&U.S. POSTAGE PAID\&Shippo\&ePostage^FS^FO0,203,0^GB801,0,3,B,0^FS^FO0,215,0^FB801,1,0,C,0^A0N,57,57^FDUSPS PRIORITY MAIL^FS^FO0,266,0^GB801,0,3,B,0^FS^FO25,287,0^FB660,3,0,L,0^A0N,23,23^FDFAKE ADDRESS\&FAKE ADDRESS\&FAKE ADDRESS ^FS^FO572,287,0^FB203,2,0,R,0^A0N,23,23^FDShip Date: 05/15/24\&Weight: 1 lb^FS^FO20,484,0^BXN,4,200^FD_142075013_192055903470167000000000011^FS^FO121,484,0^FB660,4,0,L,0^A0N,32,32^FDFAKE ADDRESS\&FAKE ADDRESS\&FAKE ADDRESS\&FAKE ADDRESS^FS^FO0,812,0^GB801,0,6,B,0^FS^FO0,824,0^FB801,1,0,C,0^A0N,29,29^FDUSPS TRACKING # EP^FS^FO31,869,0^BCN,152,N,N,N,D^FD42075013>892055903470167000000000011^FS^FO0,1047,0^FB801,1,0,C,0^A0N,29,29^FD9205 5903 4701 6700 0000 0000 11^FS^FO0,1078,0^GB801,0,6,B,0^FS^FO699,1105,0^BXN,4,200^FD_142075013_192055903470167000000000011^FS^FO317,1120,0^GFA,2100,1050,21,00000FFE000000000000000000000000000000000000007FFFC0000000000000000000000000000000000003FFFFF8000000000000000000000000000000000007F803FC00000000000000000000000000000000001F80003F00000000000000000000000000000000003E00000F8000000000000000000000000000000000F8000003E000000000000000000000000000000001F0000001F000000000000000000000000000000003E00000000000000000000000000000000000000003C0800000FF0000000000000000000000000000000781C00007FFC00000007C0007C0000000000000000F01E7E01FFFE00000007C0007C0000000000000001E01FFFFFFFFF00000007C0007C0000000000000001C01FFFFFFFFF80000007C0007C0000000000000003C00FFFFFFFFFC0000007C000000000000000000003800FFC3FFFFFC0000007C000000000000000000003801FFC3FFFFFE003FE07CFE07C7CFE07DFC007FC07801FFC3FFFFFE00FFF87DFF87C7FFF07FFF01FFE07003FFC7FFFFFE00FFFC7FFF87C7FFF87FFF83FFF87007FFFFFFFFFE01FDFC7FFFC7C7FFFC7FFFC3FFF8700FFFFFFFFFFE01F07E7F1FC7C7F0FC7F0FC7E0FCE01FFFFFFFFFFE01F83C7E0FC7C7E07E7E07C7C0FCE07FFFFFFFFFFE01FE007E0FC7C7E07E7C07EFC07EE3FFFFFFFFF7BC01FFF07E07C7C7C03E7C07EFC07EFFFFFFFFFFBFFC00FFF87C07C7C7C03E7C07EFC07EFFFFFFFFFFFFF8003FFE7C07C7C7C03E7C07EFC07EFFFFFFFFFFFFF00007FE7C07C7C7C03E7C07EFC07EFFFFFF7FFDFFC000007E7C07C7C7E03E7C07EFC07EFFFFFDFFF7FFA003F03E7C07C7C7E07E7E07C7C07C7FFFFFFDFFFCC001F03E7C0FC7C7F0FC7F0FC7E0FC7FFFFFFFFFF1C001FCFE7C07C7C7FFFC7FFFC3FFF87FFFFFFFFFC1C000FFFC7C07C7C7FFF87FFF83FFF87FFFEFFFFF81C000FFF87C07C7C7DFF07FFF01FFF03FFFBFFFFE0380003FF07C07C7C7EFE07CFE007FC03FFDFFFFF8038000000000000007C0007C000000003FF7FFFFF0070000000000000007C0007C000000001FFFFFFFC0070000000000000007E0007C000000000FFFFFFF800F0000000000000007C0007C000000000FFFFFFB801E0000000000000007E0007C0000000007FFFFFF003C0000000000000007C0007C0000000003FFFFFE007800000000000000000000000000000003FFFFFC007800000000000000000000000000000001EFFFFC01F000000000000000000000000000000000FFFFD803E0000000000000000000000000000000003FFFF00F80000000000000000000000000000000001FFFF03F000000000000000000000000000000000007FBE3FC000000000000000000000000000000000003FFFFF80000000000000000000000000000000000007FFFC00000000000000000000000000000000000000FFE0000000000000000000000000000000000^FS^FO203,162,0^FB812,4,0,C,0^A0R,101,101^FDSAMPLE\&DO\&NOT\&MAIL^FS^XZ