PHP - Web en Ruso

 
Vista:
sin imagen de perfil
Val: 41
Ha aumentado su posición en 7 puestos en PHP (en relación al último mes)
Gráfica de PHP

Web en Ruso

Publicado por Jordi (28 intervenciones) el 21/11/2016 09:44:21
Hola a todos,

Estoy tratando de traducir una Web al Ruso todos los textos están en mysql y el texto en Ruso esta en UTF8 y en mysql se ve correctamente pero desde la Web no.

La tabla es esta:



En el html tengo la codificacion en utf8. Pero los texto solo aparecen signos raros.

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Lawliet
Val: 478
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Web en Ruso

Publicado por Lawliet (351 intervenciones) el 22/11/2016 02:26:52
Hola...

Por que no intentas lo siguiente tanto en tu HTML como en tu archivo PHP.

HTML
1
2
3
4
5
6
7
8
9
<html>
	<head>
		<title>Codificacion</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	</head>
	<body>
		UTF-8
	</body>
</html>

PHP
1
2
3
4
5
<?php
	header('Content-Type: text/html; charset=utf-8');
 
	/*Código...*/
?>

Sin más que comentar, quedo al pendiente de las dudas y/o comentarios.

Saludos!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil
Val: 41
Ha aumentado su posición en 7 puestos en PHP (en relación al último mes)
Gráfica de PHP

Web en Ruso

Publicado por Jordi (28 intervenciones) el 22/11/2016 08:30:16
Hola Lawliet,

Gracias por la respuesta. Te explico los textos que están directamente el html los veo bien el problemas los tengo con los que llegan desde el mysql y no entiendo porque los que llegan desde mysql los veo mal. La base de datos esta en utf8 y el texto en la base de datos se ve bien.

Te dejo el codifo de una de la paginas:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php require_once('Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$colname_home = "-1";
if (isset($_GET['id'])) {
  $colname_home = $_GET['id'];
}
mysql_select_db($database_argentino, $argentino);
$query_home = sprintf("SELECT * FROM textos_dcha WHERE id = 1", GetSQLValueString($colname_home, "int"));
$home = mysql_query($query_home, $argentino) or die(mysql_error());
$row_home = mysql_fetch_assoc($home);
$totalRows_home = mysql_num_rows($home);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/plantilla_ru.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>LA WEB</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
 
		<!-- styles needed by jScrollPane - include in your own sites -->
		<link type="text/css" href="scripts/vitch-jScrollPane-f3143b0/style/jquery.jscrollpane.css" rel="stylesheet" media="all" />
 
 
        <!-- latest jQuery direct from google's CDN -->
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
		<!-- the mousewheel plugin -->
		<script type="text/javascript" src="scripts/vitch-jScrollPane-f3143b0/script/jquery.mousewheel.js"></script>
		<!-- the jScrollPane script -->
		<script type="text/javascript" src="scripts/vitch-jScrollPane-f3143b0/script/jquery.jscrollpane.min.js"></script>


		<script type="text/javascript" id="sourcecode">
$(function()
{
	$('.scroll-pane').jScrollPane(
		{
			showArrows: true,
			arrowScrollOnHover: true
		}
	);
});
		</script>
        <script type="text/javascript">
	var $ = jQuery.noConflict();
	</script>

<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" />

    <script type="text/javascript" src="scripts/jquery.ez-bg-resize.js" charset="utf8"></script>

<script type="text/javascript">
		$(document).ready(function() {
			$("body").ezBgResize({
				img     : "img/fondos/home_solo3.jpg", // Relative path example.  You could also use an absolute url (http://...).
				opacity : 1, // Opacity. 1 = 100%.  This is optional.
				center  : true // Boolean (true or false). This is optional. Default is true.
			});
		});
	</script>




<!-- InstanceEndEditable -->
<!-- main css -->
<link href="css/estilos.css" rel="stylesheet" type="text/css" />
<!-- media queries css -->
<link href="css/media-queries.css" rel="stylesheet" type="text/css">
</head>

<body>
<?php include_once("includes/analyticstracking.php") ?>
<div id="wrapper">
    	<div id="col1">
        	<div id="sepmenuhaut">
            </div>
        	<div id="menu">
            	<ul id="menudedans">
            	  <!-- InstanceBeginEditable name="menudedans" -->
                  		<li class="menuin"><span style="font-weight:normal">&gt;</span>HOME</li>
                		<li><a href="carta.php">MENÚS1</a></li>
                        <li><a href="menus.php">MENÚS2</a></li>
                        <li><a href="galeria.php">MENÚS3</a></li>
                		<li><a href="MENU.php">MENÚS4</a></li>
                		<li><a href="MENU.php">MENÚS5</a></li>
                		<li><a href="MENU.php">MENÚS6</a></li>
                		<li><a href="MENU.php">MENÚS7</a></li>
                		<li><a href="MENU.php">MENÚS8</a></li>
				  <!-- InstanceEndEditable -->
            	
              </ul>
            </div>        	
        </div>
        <div id="col2">
        	<div id="cabecera">
        		<div id="logo">
       	    		<p><a href="index.php"><img src="img/logo.png" /></a></p>
	            </div>
    	        <div id="lineas">
        	    </div>
            	<div id="idiomas">
            		<p><a href="indexcat.php">CAT</a> &nbsp;&nbsp; <a href="indexen.php">ING</a> &nbsp;&nbsp; <a href="indexfr.php">FRA</a></p>
	            </div>
            </div>
            <div id="cuerpo">
			<!-- InstanceBeginEditable name="cuerpo" -->
            	
				<img id="imagehome" src="<?php echo $row_home['img']; ?>" />
			
			<!-- InstanceEndEditable -->
       	    	
            </div>
            <div id="pie">
            	<div id="galeria"><!-- InstanceBeginEditable name="galeria" --><div id="menucentre"><a href="menus.php"><img src="img/menus/iconos/iconos 1.png" width="7%" style="float:left; padding:2%" /> <br />MENÚS<br /> MENÚS</a></div><!-- InstanceEndEditable -->
                </div>
                <div id="tel">
                	<div id="direc">
            			<p><a href="http://maps.google.es/maps?q=Carrer08011+Barcelona,+Catalunya&t=m&z=17" target="_blank">ARAGÓN </a></p>
                    </div>
                    <div id="iconos">
                    	<div id="facebook" onclick="window.open('https://www.facebook.com/page','_blank');" style="cursor:pointer;">
                        	<img src="img/facebook.png" />
                        </div>
                        <div id="mail" onclick="location.href='mailto:elma@gmail.com'" style="cursor:pointer;">
                        	<img src="img/mail.png" />
                        </div>
                        <div id="telef">
                        	<img src="img/tel.png" />
                        </div>
                    </div>
                    <div id="tele">
                    	<p>+965565655</p>
                    </div>
                </div>
            </div>
            <div id="piebottom"></div>
        </div>
        <div id="col3">
        	<div id="septexto">
            </div>
        	<!-- InstanceBeginEditable name="texto" -->
            	<div id="texto">
                <div id="septextoin"></div>
            	<div id="textoin">
                <div class="scroll-pane">
					<?php echo $row_home['ru']; ?>
                  </div>
                </div>
                </div>
			<!-- InstanceEndEditable -->
        </div>
    </div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($home);
?>

Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de kip
Val: 2.325
Plata
Ha disminuido 1 puesto en PHP (en relación al último mes)
Gráfica de PHP

Web en Ruso

Publicado por kip (877 intervenciones) el 22/11/2016 14:23:41
Hola, intenta colocando la funcion mysql_set_charset() para especificar el conjunto de caracteres que se usara para la conexion, asi:

1
2
3
4
5
6
mysql_set_charset('utf8',$argentino);
mysql_select_db($database_argentino, $argentino);
$query_home = sprintf("SELECT * FROM textos_dcha WHERE id = 1", GetSQLValueString($colname_home, "int"));
$home = mysql_query($query_home, $argentino) or die(mysql_error());
$row_home = mysql_fetch_assoc($home);
$totalRows_home = mysql_num_rows($home);

Nos cuentas si pudiste solucionarlo.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
2
Comentar
sin imagen de perfil
Val: 41
Ha aumentado su posición en 7 puestos en PHP (en relación al último mes)
Gráfica de PHP

Web en Ruso

Publicado por Jordi (28 intervenciones) el 22/11/2016 19:14:11
Muchas gracias funciona perfectamente.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar