Foros del Web » Programando para Internet » PHP »

caracteres raros

Estas en el tema de caracteres raros en el foro de PHP en Foros del Web. buenas tardes al rescatar valores con acento y ñ me tira caracteres raros algo asi Este curso tiene un costo de $300.000.- (trescientos mil pesos) ...
  #1 (permalink)  
Antiguo 10/09/2010, 12:37
 
Fecha de Ingreso: octubre-2005
Mensajes: 129
Antigüedad: 18 años, 6 meses
Puntos: 0
De acuerdo caracteres raros

buenas tardes al rescatar valores con acento y ñ me tira caracteres raros
algo asi

Este curso tiene un costo de $300.000.- (trescientos mil pesos) por participante. El código Sence es 12.37.7824-62. También está disponible como curso cerrado.

que puedo hacer para solucionar este problema

__________________
Pablo Baez
  #2 (permalink)  
Antiguo 10/09/2010, 12:46
 
Fecha de Ingreso: octubre-2009
Mensajes: 9
Antigüedad: 14 años, 6 meses
Puntos: 0
Respuesta: caracteres raros

fijate en el meta en el encabezado de la página!
  #3 (permalink)  
Antiguo 10/09/2010, 12:53
 
Fecha de Ingreso: enero-2010
Mensajes: 25
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: caracteres raros

Pon este código en el head sustituyendo a la que tienes

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<? utf8_decode($cadena); ?>

No falla nunca.
Un saludo.
  #4 (permalink)  
Antiguo 10/09/2010, 13:13
 
Fecha de Ingreso: octubre-2005
Mensajes: 129
Antigüedad: 18 años, 6 meses
Puntos: 0
Desacuerdo Respuesta: caracteres raros

lo copie, lo coloque en la cabecera y no funciona ademas tengo la coneion ala base de datos

Código:
<?php
$config = array(
	"dbserver"	=>	"localhost",
	"dbname"	=>	"casa",
	"dbuser"	=>	"root",
	"dbpassword"=>	"1234"
);

$conector = @mysql_connect($config[dbserver],$config[dbuser],$config[dbpassword]);/*Abriendo conexion base de datos*/
$ping=@mysql_ping($conector);
if($ping){
	@mysql_select_db($config[dbname],$conector);/*Seleccionando base de datos*/
	mysql_query("SET character_set_results='utf8'",$conector);
}
else{
	print mysql_error();
	print"<center><h3>Error de conexi&oacute;n</h3></center>";
	exit;
}
?>
se supone que asi no tendria problemas pero no funciona
__________________
Pablo Baez
  #5 (permalink)  
Antiguo 10/09/2010, 13:35
 
Fecha de Ingreso: enero-2010
Mensajes: 25
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: caracteres raros

Quizá no me expliqué bien. Debes ponerlo tal cual te lo he enviado dentro del <head> en el html de tu web sustituyendo el código que tienes como juego de caracteres en las etiquetas "meta".
Funciona seguro y siempre. Yo he hecho más de 300 web con base de datos y jamás me ha dado fallos.

Ya me dirás si te funciona, seguro que sí.
  #6 (permalink)  
Antiguo 13/09/2010, 07:54
 
Fecha de Ingreso: octubre-2005
Mensajes: 129
Antigüedad: 18 años, 6 meses
Puntos: 0
De acuerdo Respuesta: caracteres raros

holaa aqui esta mi codigo completo yy no me funciona

Código:
<?php
include("data/dbapertura.php");

$CodigoPrograma=$_GET["CodigoPrograma"];
$sql= "Select * from programas where pro_publicar = 'S' and pro_codigo = '$CodigoPrograma'";
$query = mysql_query($sql,$conector);

If (mysql_num_rows($query)>0)
{
	$Titulo = $row["pro_titulo"];
	$Codigo = $row["pro_codigo"];
	$Detalle= $row["pro_detalle"];
	$Archivo= $row["pro_imagen"];
}
mysql_free_result($query);
?>

<html>
<style type="text/css">
BODY {
scrollbar-face-color: #000066;
	scrollbar-shadow-color: #ffffff;
	scrollbar-highlight-color: #000066;
	scrollbar-3dlight-color: #ffffff;
	scrollbar-darkshadow-color: #000066;
	scrollbar-track-color: #000066;
	scrollbar-arrow-color: #ffffff;
}
//-->

</style>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<link href="css/vinculos.css" rel="stylesheet" type="text/css">
<link href="css/estilos.css" rel="stylesheet" type="text/css">
<head>
<title>Documento sin t&iacute;tulo</title>
<!-- aqui esta el codigo -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<? utf8_decode($cadena); ?> 

<link href="css/backg01.css" rel="stylesheet" type="text/css">
<link href="css/textos.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#000066" leftmargin="0" topmargin="15" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="190" valign="top"> 
    	<?php
    		include("IncludeMenuCapacitacion.php");
    	?>
    	</td>
    <td align="center" valign="top">
<table width="680" border="0" cellpadding="3" cellspacing="0" class="contblanco">
        <tr> 
          <td width="586" height="42"><img src="images/titulos/capacitacion.jpg" width="460" height="32"></td>
        </tr>
        <tr> 
          <td valign="top" class="titblanco1">&nbsp;</td>
        </tr>
        <tr> 
          <td valign="top" class="titblanco1"><?=$Titulo?></td>
        </tr>
        <tr> 
          <td align="right" valign="top">
		  
		  <?php if (Trim($Archivo) <> "") {?>
		  		<a href="#" class="vermas" onClick="MM_openBrWindow('ImagenCurso.php?Imagen=<?=$Archivo?>&NombrePrograma=<?=$Titulo?>','','scrollbars=yes,width=885,height=500')">ver calendario completo</a>
          <?php }?>
		</td>
		</tr>
        <tr> 
          <td valign="top"><strong>PRESENTACI&Oacute;N </strong> <p><?=str_replace(chr(13),"<br>",$Detalle)?></p></td>
        </tr>
        <tr>
          <td valign="top">&nbsp;</td>
        </tr>
        <tr> 
          <td valign="top"><strong>
		  <?php if ($_REQUEST["CodigoPrograma"] == 1) { print("CURSOS &Aacute;REA DE AUTOMATIZACION"); } else{ print("CURSOS &Aacute;REA DE ACCIONAMIENTO");}?>
		  </strong></td>
        </tr>
        <tr> 
          <td valign="top">&nbsp;</td>
        </tr>

<?php
$sql =  "Select * from cursos where cur_publicar = 'S' and pro_codigo = ".$_REQUEST["CodigoPrograma"]." order by cur_orden";
$query = mysql_query($sql,$conector);

while ($row = mysql_fetch_array($query)) {
	
	$TituloCurso = $row["cur_titulo"];
	$CodigoCurso = $row["cur_codigo"];
?>
        <tr> 
          <td valign="top"><a href="DetalleCurso.php?CodigoCurso=<?=$CodigoCurso?>&NombrePrograma=<?=$Titulo?>&Archivo=<?=$Archivo?>" target="contenido" class="botonblanco2"><?=$TituloCurso?></a></td>
        </tr>
<?php
}
mysql_free_result($query);
?>

      </table>
    </td>
  </tr>
</table>
</body>
</html>
<?php
include("data/dbcierre.php");
?>
__________________
Pablo Baez
  #7 (permalink)  
Antiguo 14/09/2010, 10:01
Avatar de rickyper  
Fecha de Ingreso: abril-2009
Mensajes: 182
Antigüedad: 15 años
Puntos: 10
Respuesta: caracteres raros

Debes chequear la configuracion general de apache:
http://blog.rodrigorega.es/configurar-codificacion-utf8-apache-mysql-html/

Etiquetas: caracteres, raros
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

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 13:39.