Example: web_sjis_to_euc_param

Example 1

In the following example, a user submits a request to find an employee by the name of "John Green" who is "35" years old. The strings "John Green" and "35" are first converted from EUC to SJIS.

web_sjis_to_euc_param("Name", "John Green")
web_sjis_to_euc_param("Age", "35");
web_submit_form("search.exe", 
     ITEMDATA,
     "name=employees.NAME", "Value={Name}", ENDITEM,
     "name=employees.AGE", "Value={Age}", ENDITEM,
      LAST );

Example 2

In the following example, the message, "Customer name is: Peter Brown", is converted from SJIS to EUC and sent out.

lr_save_string("Peter Brown", "SubParam");
web_sjis_to_euc_param("Param_main", "Customer name is: 
    {SubParam}");
lr_output_message("%s", lr_eval_string("{Param_main}"));

Example 3

Manual conversion of an SJIS string to EUC

A browser converts an EUC–encoded web page into SJIS encoding before displaying it. However, when you view the source of the web page, the text strings are still in EUC. If you want to search for a string in the source view, which is SJIS–encoded in the browser view, you must first convert the string back to EUC.

In the following example, the web_sjis_to_euc_param functionconverts the SJIS–encoded string, "search for this string" to EUC and searches for it in the EUC–encoded text.

web_sjis_to_euc_param("Param_Text", "search for this string");
web_find("Text check", "What={Param_Text}", LAST );.

Example 4

Correlation with right and left boundaries

In the following example, the web_sjis_to_euc_param function defines left and right boundaries, and converts them from SJIS to EUC to retrieve a string between the boundaries. This string is the session ID of a URL. The string is then sent to the Controller.

web_sjis_to_euc_param("Param_LB", "My Left Boundary in SJIS");
web_sjis_to_euc_param("Param_RB", "My Right Boundary in SJIS");
web_reg_save_param("ParamMain", "LB={Param_LB}", "RB={Param_RB}",
    LAST );
web_url("yahoo", "URL=http://www.yahoo.co.jp/SessionID={ParamMain}",
   LAST );
lr_output_message("%s", lr_eval_string("{ParamMain}"));