Jump to content

php spanish character problem


greenCountry

Recommended Posts

hello everyone,

 

This is important,I am trying to post some spanish characters from a form on a page and i am comparing those spanish characters to the same letters on the same page but on strcmp the return is not zero.I don't know what is wrong some problem with the post method i guess or strcmp i don't know....Please help....here is the code...

 

<html><body><?php

echo(strcmp('í',$_POST['check']));

?>

 

<form action="./index.php" method="post">

<input type="text" name="check">

<input type="submit" name="go" >

</form>

</body></html>

 

the name of the file is index.php and i am typing í in the text box before pressing submit.the result is not coming as zero but -1.The result is not coming for any of spanish or special characters like ¿,ñ,ü how to solve it that echo answer is zero.

 

I have searched a lot on net and finally i am coming here to get some help.

Link to comment
Share on other sites

well regarding the character set using phpinfo() i got the apache characterset as (iso-8859-1, utf-8, utf-16, *;q=0.1) this the value of HTTP_ACCEPT_CHARSET under Apache Environment heading and (iso-8859-1, utf-8, utf-16, *;q=0.1) is the value of Accept-Charset under HTTP Request Headers heading.

 

hope this helps you to figure out the problem

 

thank you.

Link to comment
Share on other sites

This gives me "0":

 

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
	<?php
		if ($_POST) {
			echo(strcmp('í',$_POST['check']));
		}
	?>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
		<input type="text" name="check" value="í">
		<input type="submit" name="go" >
	</form>
</body>
</html> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.