I developed a Pyramid application with Chameleon templates. I use the i18n module of Chameleon to access the gettext based translation mechanism. In my translated .po files I have German umlauts. These umlauts are not escaped somewhere and directly appear in the browser while other characters like & are transformed to &
As a workaround I escaped all special characters in the .po file. Is there a better / automatic way?
Related
In Python I am attempting to translate Arabic characters within a image. I can provide the language 'source' type (Arabic) and 'destination' (English). Is there a python library or API that is free that I can use for this? I.e that provides a service like https://translate.google.com, that allows for cloud image translation (the uploading of images containing non-translated characters) and downloading of images containing the destination characters translated within the image? Or a library to do this locally within my system (i.e. detect Arabic characters from an image containing Arabic text, extract the Arabic characters, for using cloud translation services (e.g. google translate) and then modify the image containing Arabic characters with the newly translated English characters? So, my goal is to modify/replace the Arabic characters within an image containing Arabic characters with English characters that are the translated characters of the original/extracted Arabic characters. I know Yandex / https://translate.yandex.com/ocr allows for this however you must pay for their translation API. How could I do this?
While I'm not sure if there is support for Arabic, there are libraries like OpenCV2 for python and pytesseract to extract text from image. Then you can use another library like translate to finish the process from there. https://pypi.org/project/translate/
Is there a framework supported way in MVC.net to decode diacritics in a textbox without just decoding the whole string and allowing HTML content?
If, the text box contains:
<b>Café<b>
When re-rendering the page it becomes:
<b>Café</b>
What is the correct way to allow these diacritics to display properly? using the inbuilt decode option results in:
Café
I could make a whitelist and convert these characters on the fly, but that seems clunky as I might miss some or allow potentially dangerous characters through by mistake. What is the recommended way to support these characters in MVC5?
I often use '#' in directory names (because names that start with that character are sorted before names that start with a letter or number).
But if I try to write a path containing a name with that character in Markdown in GitLab it is rendered as a 'mention' (of a user or group). I don't want that. Presumably GitLab might also actually notify the user or group too – I definitely don't want that!
So how can I quote or escape the '#' so that it's rendered normally?
Combine tags for an HTML span with the relevant HTML character entity:
*C:\\<span>#</span>code\my-project*
*~/<span>#</span>code/my-project*
See:
Character Entity Reference Chart – HTML5 Reference – W3C
Wrap all directory names in code spans (single back-ticks). While this is bordering on opinion, many would argue that directory names (paths, URLs, etc.) should be marked up as "code". And if you do wrap them in code spans, then they will not be treated as a "mention".
A Windows path (`C:\\#code\my-project`) and a posix path (`~/#code/my-project`).
The above example gets rendered as...
A Windows path (C:\\#code\my-project) and a posix path (~/#code/my-project).
I am using the markdown editor and I have loaded Mathjax in all pages of my website.
I have realized that this line of latex works well:
$(u_1)$
However, this one does not work (basically latex does not work):
$(u_1,u_2)$
In order to make this work, I have to write something like this:
$(u\_1,u\_2)$
I have a similar problem here. This does not work:
$$M=\left(\begin{array}{cc}
a & b \\
c & d \\
\end{array}\right)$$
But this works:
$$M=\left(\begin{array}{cc}
a & b \\\\
c & d \\\\
\end{array}\right)$$
This is a common issue of mixing LaTeX-input with Markdown. From the MathJax documentation:
There cannot be HTML tags within the math delimiters (other than <br>) as TeX-formatted math does not include HTML tags.
And later:
Another source of difficulty is when MathJax is used in content management systems that have their own document processing commands that are interpreted before the HTML page is created. For example, many blogs and wikis use formats like Markdown to allow you to create the content of you pages. In Markdown, the underscore is used to indicate italics, and this usage will conflict with MathJax’s use of the underscore to indicate a subscript. Since Markdown is applied to the page first, it will convert your subscripts markers into italics (inserting tags into your mathematics, which will cause MathJax to ignore the math).
As other answers on SO (see the link at the top) point out, some markdown parsers are more aware of TeX-like syntax than others.
I have string " Single 63”x14” rear window" am parsing this string into HTML and creating a word document applying styles using(System.IO.File.ReadAllText(styleSheet)).
in the document am getting this string as "Single 63â€x14†rear window" in C#.
How can I get the correct character to show up in Word?
You would have to find out the incoming encoding of the string
" Single 63”x14” rear window"
And also which encoding the word document allows.
It appears that the encoding characters for those funky quotes are not supported by Word. You could always create a nifty little string parser to search for characters outside the Word encoding range and replace them with either String.Empty, or search for specific supported characters that look similar.
Eg. String.Replace("”","\"");
(this probably wouldn't work without directly manipulating the encoding values, but you haven't provided those so can't give an exact example)
The encoding you are looking at appears to be UTF-8. It's actually probably exactly what you want, you just need to view it using a tool which supports UTF-8, and if you process it and put it on a web page, add the required HTML meta tag so that browsers will display it using the correct encoding.