Laravel failing to parse Arabic lines - laravel

I am trying to build a website using Laravel. I wanted to add Arabic language so I created a folder for it and made it the default in the config.php file.
Every time I use (trans) or (Lang::get) to load line from the Arabic file, not only the is not loaded right, but also the whole array is loaded with random letters instead of the Arabic text.
I tried changing the encoding of the file to UTF-8 or Unicode (both the Arabic file and the view) and I got really weird results (Japanes/Chinese letters sometimes).
is there something I am missing?

Related

Can anyone share a chinese supported pdf template sample

Is there anything we need to change on pdf template level to support Chinese or Japanese . I am using a fillable template. While writing it with my pdf library(using tcpdf) it is giving some garbled text. While copy pasting Chinese text to this template field also gives some squares where as English is filling perfectly. Does anyone out there have a sample fillable pdf template that supports Chinese to share?
generally you need to embed font to properly display foreign characters in a PDF. I've not tried using tcpdf but saw posts that say embedding a TTF (true type font) of the correct language seems to do the trick.

angular-translate and escaped characters

I have an app that uses AngularJS along with angular-translate to provide localization. The app currently uses only English and German.
On the login page is a required field, an email. If there is an error, the app displays "A valid email is required" in English.
In German (and forgive me if this is mangled, this is Google Translate, I don't know any German) the phrase is "Eine gültige E-Mail erforderlich".
In the second word, you'll notice an international character, it looks like a "u" with two little dots over it. When the app is set to display in German, that character gets escaped and much weirdness happens on the screen.
Looking that the docs, it seems like using $translateProvider.useSanitizeValueStrategy() is supposed to handle this, but it's not. If I use $translateProvider.useSanitizeValueStrategy('escaped') then it look like this onscreen:
If use $translateProvider.useSanitizeValueStrategy('sanitize')(which I'd really prefer of course) then it looks like this:
I also happened to come across this article which states that my *.js translation file needs to be UTF-8 encoded. I opened up that file in NotePad++, changed the encoding to UTF-8 Without BOM and saved it, but I'm still seeing the error. And VS really hates the file now.
I know, it's a little late, but maybe others have similar Problems:
Adressing the UI:
Are you using the attribute style e.g.
<span translate="key"><span>
or inline style
<span>{{key | translate}}</span>
in your view?
I am working with the second style without issues.
Addressing your Problem with UTF-8:
I am not using Visual Studio nor Notepad++, so I don't know how Notepad++ handles the conversion. Possibly it does not convert the characters at all, but only changes the file to be seen as UTF-8.
Sublime Text 2 (1), on the other hand, offers you to 'Save with Encoding', which converts all characters accordingly. I stressed this conversion pretty much, so that I can recommend this approach with a clean conscience.
(1) I have no relations to Sublime Text, this is not meant be any form of commercial advertisement

UTF-8 but still not showing ÆØÅ (danish chars)

Take a look at this:
http://thebekker.dk/_skole/GFeksamen/
You can see the 2nd menu item show some weird sign, instead of "Ø"
Ive set utf-8 in meta, and even tryed with AddDefaultCharset UTF-8 in .htaccess...
Still no result, if i change to ISO-8859-1 which works fine, but that makes problem when i start making ajax calls for content...
I dont get it?
How do i get it to use UTF-8 and show ÆØÅ
If you declare that your content is encoded in UTF-8 with the meta tags or default charset, then your content needs to be actually encoded in UTF-8. The fact that it shows correctly when declaring your content to be encoded in ISO-8859 means that your content is actually encoded in ISO-8859. Save your source code file as UTF-8 or otherwise make sure that your content is UTF-8 encoded.
Saving the source file in "Western European (Windows)" in EditPlus text editor did it for me + in PHP I used utf8_encode.
you can set this characters with unicode like € or so many others. In my company we work with many translations and languages like france, that has many special chars.
set your website encoding type to utf-8 and use encodings like utf8_encode in php
or manually: http://www.sql-und-xml.de/unicode-database/online-tools/

How can I correctly print Arabic through Ruby?

I'm trying to generate images through RMagick that contain Arabic text that has been parsed from an excel spreadsheet. Arabic letters change shape depending on their neighbors and this seems to happen in excel for displaying purposes only. The letters are not stored in their modified form, so they print out incorrectly. Does anyone know of a library that addresses this? TIA
What version of Ruby are you using? Also, is ImageMagick supposed to render Arabic text correctly in the first place? If not, you might want to use Prawn or something to generate a PDF file...
You need to reshape Arabic text in Ruby for ImageMagick/RMagick to render it correctly.
This is already solved for Java(Better-Arabic-Reshaper) and Python(arabic_reshaper). Do the same task in Ruby text before passing it to ImageMagick. linux CLI: how to render Arabic text into bitmap

zend_pdf right to left languages problem

i am using zend_pdf to create pdf files from persian language texts.
i have two problem:
1- i want to change document's direction to right to left as persian, arabic and some other languages are.
2- i use Zend_Pdf_Font::fontWithPath('myfont.ttf'); to set a persian font. but when i render the pdf document i see that characters are separated one by one. but in persian characters of a word are joint together.
thx in advance.
i finally used tcpdf class for generating pdf files using php. it has good support for RTL languages and UTF. it also has a good fiture for converting html to pdf.

Resources