Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [html/sql]Kodowanie
Forum PHP.pl > Forum > Przedszkole
-Aimar-
Witam,
Mam czyste gentoo + apache 2 + mysql 5 + php5

Na tym zaimportowałem bazę w utf8 (eksportowana tez w utf8) - wchodzę do phpmyadmina i widzę polskie znaczki, wykonuję skrypt i zamiast polskich znaczków widzę "?"
Deklaracja kodowania w samym skrypcie jest poprawna...


Jakieś sugestie? snitch.gif
Z góry dzięki
Aimar
plurr
zmien kodowanie pliku, wiekszosc edytorow ma taka mozliwosc
potreb
Aimar, chyba spania nie masz. Ustaw dla połączenia z baza set names utf8.
-Aimar-
Cytat
Aimar, chyba spania nie masz.


Zdecydowanie :]
Brakuje troche smile.gif

OK, anyway...

Przedstawię jeszcze raz, jak sytuacja wygląda...

Info o MySQL'u:


Metoda porównań dla tabel:


PL znaczki w phpmyadminie:


No i widok z samego forum:


I najważniejsze, czyli to zło, które łączy mnie do bazy:
  1. <?php
  2. /**
  3. * Connects to the specified database server(s)
  4. *
  5. * @param string Name of the database that we will be using for select_db()
  6. * @param string Name of the master (write) server - should be either 'localhost' or an IP address
  7. * @param integer Port for the master server
  8. * @param string Username to connect to the master server
  9. * @param string Password associated with the username for the master server
  10. * @param boolean Whether or not to use persistent connections to the master server
  11. * @param string (Optional) Name of the slave (read) server - should be either left blank or set to 'localhost' or an IP address, but NOT the same as the servername for the master server
  12. * @param integer (Optional) Port of the slave server
  13. * @param string (Optional) Username to connect to the slave server
  14. * @param string (Optional) Password associated with the username for the slave server
  15. * @param boolean (Optional) Whether or not to use persistent connections to the slave server
  16. * @param string (Optional) Parse given MySQL config file to set options
  17. * @param string (Optional) Connection Charset MySQLi / PHP 5.1.0+ or 5.0.5+ / MySQL 4.1.13+ or MySQL 5.1.10+ Only
  18. *
  19. * @return none
  20. */
  21. function connect($database, $w_servername, $w_port, $w_username, $w_password, $w_usepconnect = false, $r_servername = '', $r_port = 3306, $r_username = '', $r_password = '', $r_usepconnect = false, $configfile = '', $charset = '')
  22. {
  23. $this->database = $database;
  24.  
  25. $w_port = $w_port ? $w_port : 3306;
  26. $r_port = $r_port ? $r_port : 3306;
  27.  
  28. $this->connection_master = $this->db_connect($w_servername, $w_port, $w_username, $w_password, $w_usepconnect, $configfile, $charset);
  29. $this->multiserver = false;
  30. $this->connection_slave =& $this->connection_master;
  31.  
  32. if ($this->connection_master)
  33. {
  34. $this->select_db($this->database);
  35. }
  36. }
  37.  
  38. /**
  39. * Initialize database connection(s)
  40. *
  41. * Connects to the specified master database server, and also to the slave server
     if it is specified
  42. *
  43. * @param string Name of the database server - should be either 'localhost' or an IP address
  44. * @param integer Port of the database server (usually 3306)
  45. * @param string Username to connect to the database server
  46. * @param string Password associated with the username for the database server
  47. * @param boolean Whether or not to use persistent connections to the database server
  48. * @param string Not applicable; config file for MySQLi only
  49. * @param string Force connection character set (to prevent collation errors)
  50. *
  51. * @return boolean
  52. */
  53. function db_connect($servername, $port, $username, $password, $usepconnect, $configfile = '', $charset = '')
  54. {
  55. if (function_exists('catch_db_error'))
  56. {
  57. set_error_handler('catch_db_error');
  58. }
  59.  
  60. // catch_db_error will handle exiting, no infinite loop here
  61. do
  62. {
  63. $link = $this->functions[$usepconnect ? 'pconnect' : 'connect']("$servername:$port", $username, $password);
  64. }
  65. while ($link == false AND $this->reporterror);
  66.  
  67.  
  68. if (!empty($charset))
  69. {
  70. if (function_exists('mysql_set_charset'))
  71. {
  72. mysql_set_charset($charset);
  73. }
  74. else
  75. {
  76. $this->sql = "SET NAMES $charset";
  77. $this->execute_query(true, $link);
  78. }
  79. }
  80.  
  81. return $link;
  82. }
  83.  
  84. /**
  85. * Selects a database to use
  86. *
  87. * @param string The name of the database located on the database server(s)
  88. *
  89. * @return boolean
  90. */
  91. function select_db($database = '')
  92. {
  93. if ($database != '')
  94. {
  95. $this->database = $database;
  96. }
  97.  
  98. if ($check_write = @$this->select_db_wrapper($this->database, $this->connection_master))
  99. {
  100. $this->connection_recent =& $this->connection_master;
  101. return true;
  102. }
  103. else
  104. {
  105. $this->connection_recent =& $this->connection_master;
  106. $this->halt('Cannot use database ' . $this->database);
  107. return false;
  108. }
  109. }
  110.  
  111. /**
  112. * Simple wrapper for select_db(), to allow argument order changes
  113. *
  114. * @param string Database name
  115. * @param integer Link identifier
  116. *
  117. * @return boolean
  118. */
  119. function select_db_wrapper($database = '', $link = null)
  120. {
  121. return $this->functions['select_db']($database, $link);
  122. }
  123.  
  124. /**
  125. * Forces the sql_mode varaible to a specific mode. Certain modes may be
  126. * incompatible with vBulletin. Applies to MySQL 4.1+.
  127. *
  128. * @param string The mode to set the sql_mode variable to
  129. */
  130. function force_sql_mode($mode)
  131. {
  132. $reset_errors = $this->reporterror;
  133. if ($reset_errors)
  134. {
  135. $this->hide_errors();
  136. }
  137.  
  138. $this->query_write("SET @@sql_mode = '" . $this->escape_string($mode) . "'");
  139.  
  140. if ($reset_errors)
  141. {
  142. $this->show_errors();
  143. }
  144. }
  145. ?>




Serwer to ovh, ktoś już może coś tam miał i wie co dopisać :]

...No i gdzie to cos dopisać snitch.gif

P.S. Kodowanie na samym forum to iso-8859-2

Pilnie proszę o pomoc,
Z góry dzięki
-Aimar-
Przepraszam, że post pod postem, ale zapomniałem dopisać wcześniej ...

Kodownie samej bazy danych to: utf8_general_ci
-Aimar-
Znowu post pod postem, ale...

Rozwiązałem problem inną drogą smile.gif
W my.cnf zamieniłem latin1 na latin2 smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.