[OpenSIPS-Users] AVP + rest_post with utf-8 values

Liviu Chircu liviu at opensips.org
Tue Apr 4 15:24:26 EDT 2017


Well, as Linus nicely put it: "Talk is cheap. Show me the code". If you 
take a look at the hex dump, notice that the "..." display characters 
are actually "e7928e", twice. I haven't double-checked, but I have a 
pretty good feeling that they represent our Chinese symbol. Which should 
mean that everything is okay on the OpenSIPS side.

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 04.04.2017 20:42, SamyGo wrote:
> Hi Liviu,
>
> I confirm that the same happening on my side as well. but take a look 
> at the last two lines of your tcpdump the characters are converted to 
> *SIP...XXX...SIP.*
> In my case the remove web server in URL receives the data just as is 
> with dots, like SIP...XXX..SIP , thats the problem as I stated. !
>
> A bit confused, do you mean that conversion of Chinese characters to 
> "..." is the right behavior ?
>
> Looking for some details.
>
> Thanks,
> Sammy
>
>
> On Tue, Apr 4, 2017 at 9:49 AM, Liviu Chircu <liviu at opensips.org 
> <mailto:liviu at opensips.org>> wrote:
>
>     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" <http://127.0.0.1>, "$var(body)",
>     "$var(ctype)", "$var(retcode)");
>
>     produces:
>
>         0x0000:  4500 00a2 67cc 4000 4006 d487 7f00 0001 E...g. at .@
>     <mailto: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 <http://www.opensips-solutions.com>
>
>     OpenSIPS Summit May 2017 Amsterdam
>        http://www.opensips.org/events/Summit-2017Amsterdam.html
>     <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 <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>     <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>     _______________________________________________ Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>     <http://lists.opensips.org/cgi-bin/mailman/listinfo/users> 
>
> _______________________________________________
> 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/c0586b36/attachment.html>


More information about the Users mailing list