Jump to content


Photo

submitting japanese text. how to do it ?


  • Please log in to reply
4 replies to this topic

#1 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 14 October 2006 - 03:42 PM

Hello,

I am trying to make a form where the button will display the action (submit, clear, send, send password) in the language the user selects.
I am trying to get this to work with english and japanese to start.
the english version works but the japanese not
Does anybody know what exactly happens when a string is submitted with a <form method="POST">

the first function is to determine if a user has set a language or has submitted a change for the language.
the second funtion is to display the dropdown menu.
the funtcion $case=button_caption(3); gets the caption out of a mysql database and is the caption displayed on the button.

I am getting desperate and thinking about giving up on multilanguage forms. (IF ONLY IE supported buttons decently)

I would be very thankfull if anyone can show me a way (any way) how to make a button with different language captions.
Maybe it can be done using images with the caption ?

Thank you for looking
anatak

<?php
//-	language_set()	//set the language session var if not defined or changes the session var
//-	language_dropdown()	//displays the dropdown menu for the languages


function language_set()
{
	if(!isset($_REQUEST['submit'])){
		echo "geen request submit<br />";
		if(!isset($_SESSION['userlanguage'])){
			$_SESSION['userlanguage']='001';	//default English
		}
	}else{
		$submit=$_REQUEST['submit'];
		echo "submit: " . $submit."<br />";
		$case=button_caption(3);
//		$case="'".$case."'";
		echo "case: ".$case."<br />";
		if ($submit==$case){echo "submit == case<br />";}
		if($_REQUEST['submit']==$case){
			echo "submit in case= ".$_REQUEST['submit']."<br />";
			$_SESSION['userlanguage']=$_POST['Language'];
			echo "language= " . $_SESSION['userlanguage']."<br />";
		}
	}
}



function language_dropdown()
{
//select all the available languages
	$Table01 = "language";
	$Query01 = "SELECT * FROM $Table01 
				WHERE LanguageHide = 1
				ORDER BY LanguageLan_Language;";

	$Table02 = "language_button";
	$language = "Lan_ButLan".$_SESSION['userlanguage'];
	$Query02 = "SELECT Lan_ButValue, $language FROM $Table02 
				WHERE Lan_ButId=3";

//	echo $Query02;
//open read connection
	read_connection();
//execute query
	$Result01 = mysql_query($Query01) or die(mysql_error());
	$Result02 = select_1_row_check($Query02);
//close read connection
	read_close();
	if (gettype($Result02)== 'string'){
				echo 'there was a problem please contact the administrator with the following message: ';
				echo $Result02;
			}else{
				$Row02 = mysql_fetch_array($Result02);
			}
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']."?page=index"; ?>" >
<table>
<tr><td>Select your language</td></tr>
<tr><td>
<select name="Language">
<?php
//get results in row and display row
	while($Row01 = mysql_fetch_array($Result01)){
		
?>		<option value="<?php echo $Row01['LanguageLan_Nr']; ?>"><?php echo $Row01['LanguageLan_Language']; ?></option>
<?php
		}
?>
</select>
</td></tr>
<tr><td>
<?php $button=button_caption(3); ?>
<input type="submit" name="submit" value="<?php echo $button; ?>">
<br /><a href="<?php echo $button; ?>"><?php echo $button; ?></a>

<?php echo "<br />test".$button=button_caption(3); ?>

</td></tr>
 </table>
 </form>
<?php
}


?>

takasi.8008@docomo.ne.jp
tourokum@0508.jp

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 14 October 2006 - 04:22 PM

Try to change the encoding to utf-8:

header("Content-type: text/html; charset=utf-8");

Note: Put this BEFORE anything is output.

#3 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 14 October 2006 - 11:33 PM

I have this as header
<?php
session_start();
//IE6 session fix
header("Content-type: text/html; charset=utf-8; Cache-control: private");


but it does not make any difference
befor I had this in my HTML
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


takasi.8008@docomo.ne.jp
tourokum@0508.jp

#4 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 14 October 2006 - 11:52 PM

Try

EUC-JP

as the character set.

You may look into the

"mb_convert_encoding" function

#5 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 15 October 2006 - 01:45 AM

Thank you for the suggesting but I have to keep everything in UTF-8 as the website has to be able to switch between languages.
changing the character set to EUC-JP is really not a good thing to do I think.

I guess there is not a real way around my problem.
takasi.8008@docomo.ne.jp
tourokum@0508.jp




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users