[OpenSIPS-Users] AVP + rest_post with utf-8 values
Liviu Chircu
liviu at opensips.org
Tue Apr 4 09:49:00 EDT 2017
Hi SamyGo,
The rest_post() function seems to properly put _any_ given bytes on the
wire:
$var(body) = "SIP璎XXX璎SIP";
$var(ctype) = "text/plain";
rest_post("http://127.0.0.1", "$var(body)", "$var(ctype)", "$var(retcode)");
produces:
0x0000: 4500 00a2 67cc 4000 4006 d487 7f00 0001 E...g. at .@.......
0x0010: 7f00 0001 8e1d 0050 febf 3131 bf5f d711 .......P..11._..
0x0020: 8018 0156 fe96 0000 0101 080a 0142 56fa ...V.........BV.
0x0030: 0142 56fa 504f 5354 202f 2048 5454 502f .BV.POST./.HTTP/
0x0040: 312e 310d 0a48 6f73 743a 2031 3237 2e30 1.1..Host:.127.0
0x0050: 2e30 2e31 0d0a 4163 6365 7074 3a20 2a2f .0.1..Accept:.*/
0x0060: 2a0d 0a43 6f6e 7465 6e74 2d54 7970 653a *..Content-Type:
0x0070: 2074 6578 742f 706c 6169 6e0d 0a43 6f6e .text/plain..Con
0x0080: 7465 6e74 2d4c 656e 6774 683a 2031 350d tent-Length:.15.
0x0090: 0a0d 0a53 4950 e792 8e58 5858 e792 8e53 ...SIP...XXX...S
0x00a0: 4950 IP
The command I used for capturing is:
tcpdump -nnvvXSs 1514 -i any port 80
Please let me know if behavior differs on your platform.
Regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
OpenSIPS Summit May 2017 Amsterdam
http://www.opensips.org/events/Summit-2017Amsterdam.html
On 28.03.2017 19:55, SamyGo wrote:
> Hi,
>
> I've a specific problem with avps containing values in language other
> than English. For example an avp(test) holding a Chinese character
> gets converted to ? while passing to some rest_post URL.
>
> _code:_
>
> $avp(test) = $fn;
> xlog("L_INFO","Got Display Name: $avp(test) \n");
> rest_post("$avp(url)","$avp(test)" ....);
>
>
> The output in x-log line stays correct but the webserver gets the
> value of $avp(test) converted in "...??.."
>
> I've tried to add the charset=utf-8 in the content-type header but it
> doesn't help.
>
> Looking forward to get some hints/help on this.
>
> Thanks,
> Sammy
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170404/40089d22/attachment.html>
More information about the Users
mailing list