Foros del Web » Programando para Internet » PHP »

Problema con tildes

Estas en el tema de Problema con tildes en el foro de PHP en Foros del Web. Amigos el codigo es el siguiente Código: <?php $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; require("class.phpmailer.php"); $msg = ""; if ($_POST['action'] == "send") ...
  #1 (permalink)  
Antiguo 29/07/2010, 10:14
 
Fecha de Ingreso: enero-2007
Mensajes: 5
Antigüedad: 17 años, 3 meses
Puntos: 0
Problema con tildes

Amigos el codigo es el siguiente

Código:
<?php

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
require("class.phpmailer.php");
$msg = "";
if ($_POST['action'] == "send") {
	$varname = $_FILES['archivo']['name'];
    $vartemp = $_FILES['archivo']['tmp_name'];
    
	$mail = new PHPMailer();
	$mail->Host = "localhost";
	$mail->From = $_POST['email'];
	$mail->FromName = $_POST['firstname'];
	$mail->Subject ="Confirmation Abstract Lasdb 2010";
	$mail->AddAddress("[email protected]");
    $mail->AddAddress("[email protected]");
	/*	$mail->AddAddress("[email protected]");*/
	$mail->AddAddress($_POST['email']);
	if ($varname != "") {
		$mail->AddAttachment($vartemp, $varname);
	}
	$body = "
	   		<font size='2'face='arial'>
			<b>Step 1 Presenter: </b><br>
			    <b>First Name of poster presenter: </b>".$_POST["firstname"]."<br>
				<b>Last Name of poster presenter:  </b>".$_POST["lastname"]."<br>
				<b>Email Address of poster presenter: </b>".$_POST["email"]."<br>
				<b>Category of Poster presenter:  </b>".$_POST["category"]."<br>
				<b>Institution:</b>".$_POST["presenterintitution"]."<br>
				<b>Country:</b>".$_POST["presentercountry"]."<br><br>
				<b>Step 2 Announcements:</b><br>
				<b>Do you wish to be considered for one of the poster awards announcements?: </b> ".$_POST["announcements"]."<br><br>
				<b>Step 3 Advisor :</b><br>
				<b>Advisor’s Fist Name(For Students and PostDocs): </b>".$_POST["advisorfirstname"]."<br><br>
				<b>Advisor’s Last Name(For Students and PostDocs): </b>".$_POST["advisorlastname"]."<br><br>
				<b>Advisor’s Email address (For Students and PostDocs):  </b>".$_POST["advisoremail"]."<br><br>
				<b>Institution:</b>".$_POST["advisorinstitution"]."<br>
				<b>Country:</b>".$_POST["advisorcountry"]."<br><br>
                <b>Abstract Title: </b>".$_POST["abstract"]."<br><br>	
			</font>";
	$mail->Body = $body;
	$mail->IsHTML(true);
	$mail->Send();
	$msg = "Thanks, the data was sent successfully. <br> A confirmation email will reach your inbox.";
}
?>
Mi problema radica que al llegar esto a outlook o webmail, los tildes y Ñ aparecen de la siguiente forma ÑANDU (ÑANDU), necesito de sumar urgencia poder solucionar eso, ya puse
Código:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
en el html.

POR FIS!! ayuda!!!!!!!
  #2 (permalink)  
Antiguo 29/07/2010, 10:27
Avatar de EUSKARA  
Fecha de Ingreso: marzo-2010
Mensajes: 76
Antigüedad: 14 años, 1 mes
Puntos: 0
Respuesta: Problema con tildes

Código:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
yo siempre se lo quito y trabajo sobre la base de datos binario
  #3 (permalink)  
Antiguo 29/07/2010, 10:31
Avatar de gildus  
Fecha de Ingreso: agosto-2003
Mensajes: 1.495
Antigüedad: 20 años, 8 meses
Puntos: 105
Respuesta: Problema con tildes

Holas,

Podrias usar el utf8_decode, justo en la linea:

Cita:
$mail->Body = $body;
Colocarias:

Cita:
$mail->Body = utf8_decode($body);
Nos confirmas como te fue.

Saludos
Gildus
__________________
.: Gildus :.
  #4 (permalink)  
Antiguo 29/07/2010, 10:43
 
Fecha de Ingreso: enero-2007
Mensajes: 5
Antigüedad: 17 años, 3 meses
Puntos: 0
Respuesta: Problema con tildes

Con tu consejo Gildus funcionó perfecto!!!
mil GRACIAS!!!
  #5 (permalink)  
Antiguo 22/07/2011, 10:37
 
Fecha de Ingreso: julio-2011
Mensajes: 1
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: Problema con tildes

He he hecho una cuenta para poder darte las gracias Gildus.
utf8_decode funcionó a la perfeción.
Gracias totales.
  #6 (permalink)  
Antiguo 22/07/2011, 10:43
Avatar de andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Problema con tildes

Yo soluciono todos esos problemas con esto:

Código PHP:
Ver original
  1. //En las query
  2. mysql_query("SET NAMES 'utf8'");
  3.  
  4. //En los archivos PHP
  5. header ('Content-type: text/html; charset=utf-8');

Etiquetas: tildes
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:41.