Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Operating Systems > Unix
Register

Reply
 
LinkBack Thread Tools
Old 30.06.2010, 15:50   #1
zamundi mudril
 
voter's Avatar
 
Join Date: 08 2009
Location: hamzachiman
Posts: 10
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default Re: Перекодировка армянских html entities в Unicode

Есть кто живой?
Нужны варинаты перекодировки армянксих букв записаннмых в базу как html entities в Unicode.

Вот несколько вариантов, пока не очень работает
Quote:
<?php

$username = 'whatever';
$password = 'whatever';

$mysql = mysql_connect( 'localhost', $username, $password );
if(!$mysql)
{
echo 'Cannot connect to database.';
exit;
}

// put in your database name here:
$db = 'whatever';
$table = 'whatever';


$fieldsquery = "select * from ".$db.".".$table."";
$fields_result = mysql_query($fieldsquery);
$num_fields = mysql_num_fields($fields_result);

for ($j = 0; $j < $num_fields ; $j++)
{

$column = mysql_field_name($fields_result, $j);

$query = "select ".$column." from ".$db.".".$table."";
$result = mysql_query($query);
$num_result = mysql_num_rows($result);

for ($i = 0; $i < $num_result; $i++)
{
$thing1 = mysql_result($result,$i);

echo $thing1.'<br>';

$thing2 = html_entity_decode($thing1, ENT_QUOTES, 'utf-8');

echo $thing2;

$queryreplace = "update ".$db.".".$table." set ".$column." = '".$thing2."' where ".$column." = '".$thing1."'";
echo $queryreplace."<br>";
mysql_query($queryreplace);
}

}

?>
HTML Entity codes of different letters
http://vodovoz.com/HTMLentities/index.php?w=armen
Reply With Quote
Reply

Tags
armenian, html entities, unicode

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 04:03.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.