Hi List, attached is a patch to the Kannel WML compiler that fixes the problem described in my original post.
With this patch applied, the following test WML document: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card id="c1" title="A WMLC Testcase"> <onevent type="onenterforward"> <refresh> <setvar name="XY" value="This is the content"/> </refresh> </onevent> <p align="left"> <a href="http://wap.url.mobile/path?XY=$XY">$XY</a><br/> <a href="http://wap.url.mobile/path?XY=$(XY)">$(XY)</a><br/> <a href="http://wap.url.mobile/path?XY=$(XY:escape)">$(XY:escape)</a><br/> <a href="http://wap.url.mobile/path?XY=$(XY:noesc)">$(XY:noesc)</a><br/> <a href="http://wap.url.mobile/path?XY=$(XY:unesc)">$(XY:unesc)</a><br/> </p> </card> </wml> results in the following (decompiled) binary: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card id="c1" title="A WMLC Testcase" > <onevent type="onenterforward" > <refresh> <setvar name="XY" value="This is the content" /> </refresh> </onevent> <p align="left" > <a href="http://wap.url.mobile/path?XY=$(XY:escape)" >$(XY:noesc)</a> <br /> <a href="http://wap.url.mobile/path?XY=$(XY:escape)" >$(XY:noesc)</a> <br /> <a href="http://wap.url.mobile/path?XY=$(XY:escape)" >$(XY:escape)</a> <br /> <a href="http://wap.url.mobile/path?XY=$(XY:noesc)" >$(XY:noesc)</a> <br /> <a href="http://wap.url.mobile/path?XY=$(XY:unesc)" >$(XY:unesc)</a> <br /> </p> </card> </wml> As you can see, the compiler now chooses the right conversion for the context, when no conversion is supplied. Regards J�rg -----Urspr�ngliche Nachricht----- Von: J�rg Pommnitz Gesendet: Montag, 29. M�rz 2004 16:21 An: Kannel-Devel (E-Mail) Betreff: Bug in Kannel WML Compiler?? Hello all, I suspect that there is a small bug in the Kannel WML compiler. The bug is related to variable substitution as specified in http://www.openmobilealliance.org/tech/affiliates/wap/wap-191-wml-20000219-a .pdf . Section 10.3.1 Variable Substitution says: "If no conversion is specified, the variable is substituted using the conversion format appropriate for the context. All attributes defined as %HREF; default to escape conversion, elsewhere no conversion is done. Specifying the noesc conversion disables context sensitive escaping of a variable." The WML binary standard does not provide a token for a variable substitution without conversion (the defined tokens are EXT_I_0 ..EXT_I_2, EXT_T_0..EXT_T_2), that's why the WML compiler has to choose the correct one. Currently the WML compiler unconditionaly uses the "noesc" conversion for all contexts, even in the href attribute: http://www.kannel.org/cgi-bin/lxr/source/gateway/gw/wml_compiler.c#L1107 Unfortunately the function "check_variable_syntax" does not even know the context. Any suggestions? Regards J�rg
compiler.diff
Description: Binary data
