我使用TIC将文本转换为图像.
我已经对此进行了大量搜索,但它似乎是Unicode问题(初始内侧和最终字母的unicodes)或者可能是内容类型,因为图像是在PNG中.
如果我没有呼应与图像转换content type text/html
和charset=UTF-8
我得到所需的输出加入乌尔都语字母.
require_once 'lib/tic.php';
$text="???? ??? ";
TIC::factory('C:\Windows\Fonts\Nastalique.ttf')
->setText($text)
->setPadding(10)
->setBgColor('ff0000')
->setFontColor(0xff, 0xff, 0x00)
->setFontSize(24)->create(true);
Run Code Online (Sandbox Code Playgroud)
出去吧
? ? ? ? ? ? ?
Run Code Online (Sandbox Code Playgroud) 我想将标记添加到从右到左书写的(乌尔都语)文本.我试图使用gsub用于此目的,但到目前为止我尝试的所有内容都不会产生所需的输出
text <- "?? ???? ??? ???? ?? ??? ??????? ??? ?? ??? ??"
pattern <- "??? ??"
replaceWith <- paste0("<somemark>", pattern, "</somemark>")
gsub(pattern, replaceWith, text)
Run Code Online (Sandbox Code Playgroud)
gsub返回以下内容
?? ???? ??? ???? ?? ??? ??????? <somemark>??? ??</somemark> ??? ??
Run Code Online (Sandbox Code Playgroud)
期望的输出.
如何实现所需的输出?
注意:我甚至无法在帖子中正确排版所需的输出,我不得不依赖图像.
更新:虽然mysub
下面的函数正确连接字符串(在控制台中),但我仍然面临闪亮应用程序中文本顺序错误的问题.
mysub <- function(text, pattern){
beforePattern <- substr(text, 1, regexpr(pattern, text)[1]-1)
afterPattern <- substr(text, regexpr(pattern,text)[1] + nchar(pattern), nchar(text))
result <- paste(afterPattern, replaceWith, beforePattern)
result
}
Run Code Online (Sandbox Code Playgroud) 我想在乌尔都语中建立一个网站,我用Google搜索并发现了一些unicode方法,现在我的问题是这些unicode是如何工作的,或者我如何从urdu语句中提取这些代码.
以下是用于在网站中显示urdu的代码段.
<HTML>
<HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<TITLE>Ghazal</TITLE>
<STYLE TYPE="text/css"><!--
H1 {
color: #007c78;
font-family: "Urdu Nastaliq Unicode";
font-size: 60px; }
#urdu {
font-family: "Urdu Nastaliq Unicode";
font-size: 32px; }
}
--></STYLE>
</HEAD>
<BODY bgcolor="#ffffff">
<bdo dir=rtl>
<center>
<table border=0>
<tr><td align=right>
<h1 align=right>
ﻏﹷﺰﹶﻝ <br>
</h1>
<span id=urdu>
<P>
ﺷﺎﻡﹺ ﻏﹷﻢ ﻛﮯ
ﺍﺳﹻﻴﺮ ﮨﹷﻴﮟ
ﮨﹷﻢ ﻟﻮﮒ <br>
ﺳﹹﺒﺢﹺ ﻧﹷﻮ
ﻛﮯ ﺳﹷﻔﹻﻴﺮ
ﮨﹷﻴﮟ ﮨﹷﻢ
ﻟﻮﮒ <br>
<P>
ﺑﹹﺠﮫ ﭼﹹﲀ
ﮨﹷﮯ ﭼﹷﺮﺍﻍ
ﮔﻮ ﺩﹺﻝ ﰷ <br>
ﭘﮭﹻﺮ ﺑﮭﹻﯽ
ﺭﻭﺷﹷﻦ
ﺿﹷﻤﹻﻴﺮ …
Run Code Online (Sandbox Code Playgroud) I have a Urdu word "\xd9\x84\xd8\xa7\xd8\xb9\xd9\x84\xd9\x85" and more similar words. How can I split the word that I get "\xd9\x84\xd8\xa7" and "\xd8\xb9\xd9\x84\xd9\x85" separately in an array? I have tried converting the words to unicode characters, but I can,t detect the break between "\xd9\x84\xd8\xa7" and "\xd8\xb9\xd9\x84\xd9\x85".
\n\nEnglish words can be easily separated based on spaces, but I am stuck on separating Urdu words, where there are no spaces.
\n我想知道文本是否包含乌尔都语或阿拉伯语的任何字母..使用这种条件会在出现特殊字符时产生错误的结果。什么是正确的方法。
if (cap.replaceAll("\\s+", "").matches("[A-Za-z]+")
|| cap.replaceAll("\\s+", "").matches("[A-Za-z0-9]+")) {
Log.d("isUrdu", "false");
caption.setTypeface(Typeface.DEFAULT);
caption.setTextSize(16);
} else {
Log.d("isUrdu", "True");
/* if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) {*/
caption.setTypeface(typeface);
caption.setTextSize(20);
/* }*/
}
Run Code Online (Sandbox Code Playgroud) 嗨,我正在寻找 utf8mb4 的编码功能,
$var = = "???";
echo utf8mb4_encode($string);
output = نور // its $var output in UTFMB4
Run Code Online (Sandbox Code Playgroud)
输出应该是 "نور" 这个,它是 utfmb4 中 $var 的转换