<div dir="ltr">October 2019, Asterisk 17.0, this is still happening<br><br>Bug updated:
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-26481" rel="noreferrer" target="_blank">https://issues.asterisk.org/jira/browse/ASTERISK-26481</a> <br><br>File is a single line unix-line UTF-8 file, with "1," (no quote marks)<br><br>hexdump output is as follows <br><br>0000000 2c31<br>0000002<br><br>dialplan is<br><br><br> same => n(skipto),Set(unfilteredfeat=${FILE(${scanPath}/skipto.txt,0,1,l,u)})<br> same => n,Set(feature=${SHIFT(unfilteredfeat)})<br> same => n,Verbose(1,feature is ${feature} unfilteredfeat is ${unfilteredfeat})<br><br><br>Console log output is<br><br><br> -- Executing [s@root:40] Set("Local/s@root-00000011;2", "unfilteredfeat=1,▒=") in new stack<br>[Oct 29 09:36:15] ERROR[2134][C-00000012]: json.c:607 ast_json_vpack: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.<br>[Oct 29 09:36:15] ERROR[2134][C-00000012]: Got 11 backtrace records<br># 0: /usr/sbin/asterisk(ast_json_pack+0xa5) [0x5627588a7f45]<br># 1: /usr/sbin/asterisk(ast_channel_publish_varset+0x30) [0x562758937820]<br># 2: /usr/sbin/asterisk(pbx_builtin_setvar_helper+0x148) [0x5627588e8e78]<br># 3: /usr/sbin/asterisk(pbx_builtin_setvar+0x119) [0x5627588e9209]<br># 4: /usr/sbin/asterisk(pbx_exec+0x158) [0x5627588dedf8]<br># 5: /usr/sbin/asterisk(+0x137479) [0x5627588d3479]<br># 6: /usr/sbin/asterisk(+0x139134) [0x5627588d5134]<br># 7: /usr/sbin/asterisk(+0x13a7a1) [0x5627588d67a1]<br># 8: /usr/sbin/asterisk(+0x1bd598) [0x562758959598]<br># 9: /lib/x86_64-linux-gnu/libpthread.so.0(+0x9669) [0x7fa95fd1b669]<br>#10: /lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7fa95fa9f323]<br><br>[Oct 29 09:36:15] ERROR[2134][C-00000012]: stasis_channels.c:1161 ast_channel_publish_varset: Error creating message<br>[Oct 29 09:36:15] ERROR[2134][C-00000012]: json.c:607 ast_json_vpack: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.<br>[Oct 29 09:36:15] ERROR[2134][C-00000012]: Got 12 backtrace records<br># 0: /usr/sbin/asterisk(ast_json_pack+0xa5) [0x5627588a7f45]<br># 1: /usr/sbin/asterisk(ast_channel_publish_varset+0x30) [0x562758937820]<br># 2: /usr/sbin/asterisk(pbx_builtin_setvar_helper+0x148) [0x5627588e8e78]<br># 3: /usr/lib/asterisk/modules/func_strings.so(+0x64c0) [0x7fa93fd054c0]<br># 4: /usr/sbin/asterisk(ast_func_read+0x326) [0x5627588e35b6]<br># 5: /usr/sbin/asterisk(pbx_substitute_variables_helper_full+0x282) [0x5627588e7cc2]<br># 6: /usr/sbin/asterisk(+0x137445) [0x5627588d3445]<br># 7: /usr/sbin/asterisk(+0x139134) [0x5627588d5134]<br># 8: /usr/sbin/asterisk(+0x13a7a1) [0x5627588d67a1]<br># 9: /usr/sbin/asterisk(+0x1bd598) [0x562758959598]<br>#10: /lib/x86_64-linux-gnu/libpthread.so.0(+0x9669) [0x7fa95fd1b669]<br>#11: /lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7fa95fa9f323]<br><br>[Oct 29 09:36:15] ERROR[2134][C-00000012]: stasis_channels.c:1161 ast_channel_publish_varset: Error creating message<br> -- Executing [s@root:42] Set("Local/s@root-00000011;2", "feature=1") in new stack<br> -- Executing [s@root:43] Verbose("Local/s@root-00000011;2", "1,feature is 1 unfilteredfeat is ▒=") in new stack<br> feature is 1 unfilteredfeat is ▒=<br><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 18 Oct 2016 at 12:41, Jonathan H <<a href="mailto:lardconcepts@gmail.com">lardconcepts@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'm going to go ahead and file a bug report, 'cos something definitely<br>
ain't right here! Bug filed:<br>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-26481" rel="noreferrer" target="_blank">https://issues.asterisk.org/jira/browse/ASTERISK-26481</a><br>
<br>
This bit of dialplan.....<br>
<br>
exten => 5,1,Verbose(Context: ${CONTEXT} Exten:${EXTEN})<br>
same => n,Set(featurefile=/home/test/feature-1.txt)<br>
same => n,set(myList=1,12,123,1234,12345,123456,A,AB,ABC,ABCD,ABCDE,ABC123)<br>
same => n,While($["${SET(rawVar=${SHIFT(myList)})}" != ""])<br>
same => n,SET(FILE(${featurefile})=${rawVar})<br>
same => n,SET(fileVar=${FILE(${featurefile},0,1,l,u)})<br>
same => n,SET(hexDump=${SHELL(hd ${featurefile})})<br>
same => n,Verbose(Before file: ---${rawVar}--- len ${LEN(rawVar)}<br>
after file: ---${fileVar}--- len ${LEN(fileVar)} hexdump:${hexDump})<br>
same => n,EndWhile()<br>
same => n,Hangup()<br>
<br>
<br>
...produces this output: (tidied only for posting) - this is messed up<br>
in so many ways.<br>
<br>
LEN is showing the wrong length.<br>
1 character gets a weird character added.<br>
23, and 4 characters OK<br>
5 characters loses a character - BUT LOOK! Even though hexdump prints<br>
the correct contents and length, have a close look at this: 35|12345|<br>
whereas normally it would have a space before the pipe.<br>
6 characters is OK<br>
<br>
Before file: ---1--- len 6 after file: ---1▒--- len 7 hexdump:00000000<br>
31|1| 00000001<br>
Before file: ---12--- len 6 after file: ---12--- len 7<br>
hexdump:00000000 31 32 |12| 00000002<br>
Before file: ---123--- len 6 after file: ---123--- len 7<br>
hexdump:00000000 31 32 33 |123| 00000003<br>
<br>
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: json.c:704 ast_json_vpack:<br>
Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.<br>
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: stasis_channels.c:773<br>
ast_channel_publish_varset: Error creating message<br>
<br>
Before file: ---1234--- len 6 after file: ---1234--- len 7<br>
hexdump:00000000 31 32 33 34 |1234| 00000004<br>
Before file: ---12345--- len 6 after file: ---1234--- len 7<br>
hexdump:00000000 31 32 33 34 35|12345| 00000005<br>
Before file: ---123456--- len 6 after file: ---123456--- len 7<br>
hexdump:00000000 31 32 33 34 35 36 |123456| 00000006<br>
<br>
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: json.c:704 ast_json_vpack:<br>
Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.<br>
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: stasis_channels.c:773<br>
ast_channel_publish_varset: Error creating message<br>
<br>
Before file: ---A--- len 6 after file: ---A▒--- len 7 hexdump:00000000<br>
41|A| 00000001<br>
Before file: ---AB--- len 6 after file: ---AB--- len 7<br>
hexdump:00000000 41 42 |AB| 00000002<br>
Before file: ---ABC--- len 6 after file: ---ABC--- len 7<br>
hexdump:00000000 41 42 43 |ABC| 00000003<br>
<br>
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: json.c:704 ast_json_vpack:<br>
Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.<br>
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: stasis_channels.c:773<br>
ast_channel_publish_varset: Error creating message<br>
<br>
Before file: ---ABCD--- len 6 after file: ---ABCD--- len 7<br>
hexdump:00000000 41 42 43 44 |ABCD| 00000004<br>
Before file: ---ABCDE--- len 6 after file: ---ABCD--- len 7<br>
hexdump:00000000 41 42 43 44 45|ABCDE| 00000005<br>
Before file: ---ABC123--- len 6 after file: ---ABC123--- len 7<br>
hexdump:00000000 41 42 43 31 32 33 |ABC123|<br>
<br>
On 17 October 2016 at 23:12, Pete Mundy <<a href="mailto:pete@fiberphone.co.nz" target="_blank">pete@fiberphone.co.nz</a>> wrote:<br>
> On 18/10/2016, at 10:38 am, Steve Edwards <<a href="mailto:asterisk.org@sedwards.com" target="_blank">asterisk.org@sedwards.com</a>> wrote:<br>
><br>
> cat /home/test/feature-1.txt | hexdump<br>
><br>
><br>
> Or just:<br>
><br>
> hexdump /home/test/feature-1.txt<br>
><br>
><br>
> Heh.. yes, fair call ;)<br>
><br>
> Pete<br>
><br>
><br>
> --<br>
> _____________________________________________________________________<br>
> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
><br>
> Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016<br>
> <a href="http://www.asterisk.org/community/astricon-user-conference" rel="noreferrer" target="_blank">http://www.asterisk.org/community/astricon-user-conference</a><br>
><br>
> New to Asterisk? Start here:<br>
> <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" rel="noreferrer" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br>
><br>
> asterisk-users mailing list<br>
> To UNSUBSCRIBE or update options visit:<br>
> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</blockquote></div>