Jump to content
php.lv forumi

iconv konvertejot utf8 uz translitu atgriez jautajumzimes


Swear

Recommended Posts

echo iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', 'AĀBCČDEĒFGĢHIĪJKĶLĻMNŅOPRSŠTUŪVZŽ aābcčdeēfgģhiījkķlļmnņoprsštuūvzž');

izvada: A?BC?DE?FG?HI?JK?L?MN?OPRS?TU?VZ? a?bc?de?fg?hi?jk?l?mn?oprs?tu?vz?

 

kādēļ tā? uz cita servera viss strādā. setlocale() mēģināju, nelīdz..

iconv_set_encoding() arī nelīdz. kautkas ar php konfigurāciju, vai paša servera?

Edited by Swear
Link to comment
Share on other sites

Komentāros inconv dokumentācijā var atrast norādi

If you are getting question-marks in your iconv output when transliterating, be sure to 'setlocale' to something your system supports.

 

Tas ka tu mēģināji uzstādīt lokāli ar setlocale ir viena lieta. Bet vai no tā ir bijusi jēga (respektīvi, tava OS to atbalsta) ir cita lieta.

 

Pārbaudi ko atgriež setlocale

$locale = setlocale(LC_ALL, 'lv_LV');
var_dump($locale);

Edited by 101111
Link to comment
Share on other sites

<pre class="prettyprint">setlocale() atgriež false.pieliku lv_LV.UTF-8 UTF-8 iekš /etc/locale.gen, palaidu locale-gen tagad izskatās šādi:</pre>

# locale -a
C
POSIX
en_US
en_US.iso88591
en_US.utf8
lv_LV.utf8

 

ar setlocale(LC_ALL, 'lv_LV.utf8'); nostrādāja. paldies!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...