简体   繁体   English

在php中将俄语字符从大写转换为小写

[英]Converting russian characters from upper case to lower case in php

I'm trying to change the case of russian characters from upper to lower. 我试图将俄语字符的大小写从上到下改变。

 function toLower($string) {   
 echo strtr($string,'ЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ','ёйцукенгшщзхъфывапролджэячсмитьбю');
 };

This is the function I used and the output looks something like this 这是我使用的功能,输出看起来像这样

ЁЙ## ёѹ##` ЁЙ##ёѹ##`

Can anybody help me with this ? 任何人都可以帮我吗? Thanks in advance 提前致谢

$result = mb_strtolower($orig, 'UTF-8');

(假设数据在utf-8中)

Specify the charset within the HTML and use mb_strtolower() to convert case: 在HTML中指定charset并使用mb_strtolower()转换大小写:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
<html>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <head>
        <title></title>
    </head>
    <body>
<?
$string = 'ЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ' ;
echo mb_strtolower($string, 'UTF-8');
?>
    </body>
</html>

With the meta-tag it looks like this: 使用元标记,它看起来像这样:

цукенгшщзхъфывапролджэячсмитьбю

Without the meta-tag it looks like this 没有元标记,它看起来像这样

цукенгшщзхъфывапролджÑÑчÑмитьбю

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM