Jump to content
php.lv forumi

Recommended Posts

Posted

Var mēģināt ar iconv funkciju no UTF-8 uz ASCII//TRANSLIT kodējumu. Tik tur šķiet, ka pa vidu var iespraukties kāds apostrofs vai kas tamlīdzīgs.

Palasi iconv funkcijai komentārus manuāli, gan jau kaut ko labu kāds būs uzrakstījis priekšā.

Posted (edited)

Pie viena es gribētu pavaicāt vai nav kāds labs risinājums izdomāts kirlica burtu pārveidošanai uz latīņu burtiem ?

Edited by tas_pats
  • 4 weeks later...
Posted (edited)

taa kaa mulkji te par daudz sapriecaajaas, ka sitais lakiam pastulbs jautajums, izmantoju kuru es izvelejos, atvainojos ka uzreiz neieposteeju. nemts no CMSMS, tapec der piemest komentaros

 

pec idejas loti lidzigs andrisp risinajumam.

 

#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
# 




function munge_string_to_url($alias, $tolower = false)
{
// replacement.php is encoded utf-8 and must be the first modification of alias
include(dirname(__FILE__) . '/replacement.php');
$alias = str_replace($toreplace, $replacement, $alias);

// lowercase only on empty aliases
if ($tolower == true)
{
	$alias = strtolower($alias);
}

$alias = preg_replace("/[^\w-]+/", "-", $alias);
$alias = trim($alias, '-');

return $alias;
}

 

replacement.php

<?php
	$toreplace  = array(
				"Ä","ä","Æ","æ","Ǽ","ǽ","Å","å","Ǻ","ǻ","À","Á","Â","Ã","à","á","â","ã","Ā","ā","Ă","ă","Ą","ą","Ǎ","ǎ","Ạ","Ạ","ạ","Ả","ả","Ấ","ấ","Ầ","ầ","Ẩ","ẩ","Ẫ","ẫ","Ậ","ậ","Ắ","ắ","Ằ","ằ","Ẳ","ẳ","Ẵ","ẵ","Ặ","ặ",
				"Ç","ç","Ć","ć","Ĉ","ĉ","Ċ","ċ","Č","č",
				"Ð","ð","Ď","ď","Đ","đ",
				"È","É","Ê","Ë","è","é","ê","ë","Ē","ē","Ĕ","ĕ","Ė","ė","Ę","ę","Ě","ě","Ẹ","ẹ","Ẻ","ẻ","Ẽ","Ế","ế","Ề","ề","Ể","ể","ễ","Ệ","ệ","Ə","ə",
				"ſ","ſ",
				"Ĝ","ĝ","Ğ","ğ","Ġ","ġ","Ģ","ģ",
				"Ĥ","ĥ","Ħ","ħ",
				"Ì","Í","Î","Ï","ì","í","î","ï","Ĩ","ĩ","Ī","ī","Ĭ","ĭ","Į","į","İ","ı","Ǐ","ǐ","Ỉ","ỉ","Ị","ị",
				"IJ","ij",
				"fi","fl",
				"Ĵ","ĵ",
				"Ķ","ķ","ĸ",
				"Ĺ","ĺ","Ļ","ļ","Ľ","ľ","Ŀ","ŀ","Ł","ł",
				"Ñ","ñ","Ń","ń","Ņ","Ň","ň","ʼn","Ŋ","ŋ",
				"Ö","ö","Ø","ø","Ǿ","ǿ","Ò","Ó","Ô","Õ","ò","ó","ô","õ","Ō","ō","Ŏ","ŏ","Ő","ő","Ǒ","ǒ","Ọ","ọ","Ỏ","ỏ","Ố","ố","Ồ","ồ","Ổ","ổ","Ỗ","ỗ","Ộ","ộ","Ớ","ớ","Ờ","ờ","Ở","ở","Ỡ","ỡ","Ợ","ợ","Ơ","ơ",
				"Œ","œ",
				"Ŕ","ŕ","Ŗ","ŗ","Ř","ř",
				"Ś","ś","Ŝ","Ş","ş","Š","š",
				"Ţ","ţ","Ť","ť","Ŧ","ŧ",
				"Ü","ü","Ù","Ú","Û","ù","ú","û","Ụ","ụ","Ủ","ủ","Ứ","ứ","Ừ","ừ","Ữ","ữ","Ự","ự","Ũ","ũ","Ū","ū","Ŭ","ŭ","Ů","ů","Ű","ű","Ų","ų","Ǔ","ǔ","ǖ","ǘ","Ǚ","ǚ","Ǜ","ǜ","Ư","ư",
				"Ŵ","ŵ","Ẁ","ẁ","Ẃ","ẃ","Ẅ","ẅ",
				"Ý","ý","ÿ","Ŷ","ŷ","Ÿ","Ỳ","ỳ","Ỵ","ỵ","Ỷ","ỷ","Ỹ","ỹ",
				"Þ","þ","ß",
				"Ź","ź","Ż","ż","Ž","ž"
	);
	$replacement = array(
				"ae","ae","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a",
				"c","c","c","c","c","c","c","c","c","c",
				"d","d","d","d","d","d",
				"e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e","e",
				"f","f",
				"g","g","g","g","g","g","g","g",
				"h","h","h","h",
				"i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i","i",
				"ij","ij",
				"fi","fl",
				"j","j",
				"k","k","k",
				"l","l","l","l","l","l","l","l","l","l",
				"n","n","n","n","n","n","n","n","n","n",
				"oe","oe","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o",
				"oe","oe",
				"r","r","r","r","r","r",
				"s","s","s","s","s","s","s",
				"t","t","t","t","t","t",
				"ue","ue","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u","u",
				"w","w","w","w","w","w","w","w",
				"y","y","y","y","y","y","y","y","y","y","y","y","y","y",
				"th","th","ss",
				"z","z","z","z","z","z"
	);
?>

Edited by Squad
Posted

Droši vien nabadziņam apnicis izturēt savu vientulību. Visi visi apkārt ir idoti, muļķi un vispār nemāk programmēt. Nav vērts ar tādiem pat diskutēt. Viņš vienīgais saprot kā kods jāraksta.

×
×
  • Create New...