<?vsp 
--  
--  $Id: xs_e_1_sample_1.vsp,v 1.2 2006/08/15 19:30:35 source Exp $
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2006 OpenLink Software
--  
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--  
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--  
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--  
--  

  declare ostr varchar;
  ostr := '';
  if ({?'trf'} = 'Transform')
    {
      ostr := charset_recode ({?'istr'}, {?'ienc'}, {?'oenc'});
    }
?>
<html>
<head><link rel="stylesheet" type="text/css" href="../demo.css"></head>
<body>
<H3>Encoding example</H3>
<form action="xs_e_1_sample_1.vsp" method="post">
<table class="tableentry">
<tr><td>1. Choose the input encoding</td><td><select name=ienc>
  <?vsp
    declare cs any;
    declare i, l integer;
    cs := charsets_list (0);
    i := 0; l := length (cs);
    while (i < l)
      {
	http (sprintf ('<option value="%s">%s</option>', cs[i], cs[i]));
        i := i + 1;
      }
  ?>
</select></td></tr>
<tr><td>2. Choose the target encoding</td><td><select name=oenc>
  <?vsp
    declare cs any;
    declare i, l integer;
    cs := charsets_list (0);
    i := 0; l := length (cs);
    while (i < l)
      {
	http (sprintf ('<option value="%s">%s</option>', cs[i], cs[i]));
        i := i + 1;
      }
  ?>
</select></td></tr>
<tr><td>3. Enter the string</td><td><input type=text name=istr value=""></td></tr>
<tr><td>4. Get the result</td><td><input type=submit name=trf value="Transform"></td></tr>
</table>
<?vsp if ({?'trf'} is not null) { ?>
<table class="tableresult">
<tr><td>Result from transformation</td><td><p><?=ostr?></p></td></tr>
</table>
<?vsp } ?>

</form>
</body>
</html>
