How to display Arabic text to browser from database? - jquery-mobile

I'm trying to display Arabic text to my website from the database. But it will display question mark "????" . I connect it from phpMyAdmin.

You can convert your text to UTF format like this:
اسم المستخدم
Result: اسم المستخدم

Related

How to perform language transformation(Localization ) in UITable View Content in swift

i Need to convert my iOS app into arabic .i am done with converting UIComponents text but when it comes to UItabelview,i am not able to do .i am not getting how to convert text which is in an array in swift 3
You must localize your app to support different languages.
Please refer to this Medium Tutorial to get a clear idea on how to localize an app.
If you have an array of display strings that come from an API then you have a problem. If those strings are static and come from a known set of strings then you could create entries in your localizable.strings file that map each of those strings to their Arabic equivalent, and use NSLocalizedString() to convert them at runtime:
let sourceString = cellData[indexPath.row].titleString
let localizedString = NSLocalizedString(sourceString, comment: "String from API")
Ask your backend developer to add arabic string in response and then use below code:
cell.yourLabel = NSLocalizedString(YourArray[indexPath.row].arabicString, comment: "")

Auto detect language and display the correct one with javascript

I am making a website for my friend
https://photos4humanity.herokuapp.com/
I'm thinking to pull the post from its facebook page and display it on the website so he doesnt have to duplicate content for both.
Each facebook post has both english and chinese in it. like here :
https://www.facebook.com/photosforhumanity/
I would like to auto detect the language from the json file I get from facebook. Then detect which is in English and which is in Chinese then only display the right language according to internatioanlize from rails.
Is there a smart way to do this?
You could use Regex to detect if the string has any English characters or not:
isEnglish = myString.match(/[a-zA-Z]/)
or
isEnglish = myString =~ /[a-zA-Z]/
I haven't tested either of these and I don't know how your json file is organized, but this should work for a singular string.
Edit:
To pull the English characters out of the string, you can use the slice! method:
englishString = myString.slice!(/[a-zA-Z]/)
After doing that, myString should only contain non-English characters and englishString should contain only English characters.

objective-c, PDF, How to solve "failed to parse embedded CMap." issue in PDF Seaching?

I am trying perform searching text in PDF, My project works fine on mostly PDF, but it fails to search text on some PDF, and xcode shows this message on console :
"failed to parse embedded CMap." How to solve this issue, So that I can search text on all PDF. Any suggestion will be great. Thanks in advance .
In general, it is impossible to search for text in all PDFs. This is for two main reasons:
PDFs use character codes that do not correspond to Unicode. A Cmap is used in this case to associate PDF character codes with a Unicode, but is not required to be present in the PDF document.
Even if a Cmap is included, the characters of text are not guaranteed to appear in order in the PDF document. PDF displays the glyphs corresponding to a character code based on geometry not on text.

RazorPDF and Chinese character

I use Razor-PDF to create PDF.
like the following article:
http://www.dotnetjalps.com/2013/06/Creating-PDF-with-ASP-Net-MVC-and-RazorPDF.html
But I have a problem. the data consists of Chinese characters,but Chinese characters don't appear in PDF file I created. can anyone help me how to do this? thanks

Formatting NSString for superscript and subscript

I am writing a utility app for some coworkers. The app is essentially a custom notepad, with buttons that represent the shorthand they use to transcribe a task. All of the buttons add a string to arrays that I have set up to hold the transcript, and I add the strings to the row arrays like this.
[currentRow addObject:#"("];
Some of the shorthand needs to be written in subscript, and some in superscript. There are not Unicode characters for all of the characters that I need, so I have been trying to sort through the code around Attributed Strings,but I'm not quite getting it. Does anyone have advice on this or some sample code?
Also, after this transcript is printed to the screen during transcription, I send it to an email message body.. so I assume I'll need to worry about formatting there as well. I am currently using plain text, but the email could be HTML. Thanks!
If you display the text in a WebView you can use html tags to set superscript. It also has the advantage to run on older iOS versions and you can reuse the text in your mail.
NSString *myText=#"This text contains <sub>subscript</sub> and <sup>superscript</sup> text.";
[self.myWebView loadHTMLString:myText baseURL:nil];

Resources