I'm not sure how face this question, I'm working on a React web, using React-Select, but I think my problem is not related to any of those libraries but it's some html, unicode, thing.
I have a data file where I store in a JSON object some string values and emoji data. In the IDE I can't see the value of those emojis, but it looks like this:
When I use in a React native mobile app those emojis, they work ok, and I can see them, but not in web, I just get this rendered:
So, how could I use those emojis from the data file in a web app?
Set UTF-8 encoding in your IDE.
Related
I am having a problem in showing Hebrew letters on my HTML page. I am using (as far as I know maybe I'm wrong) JSON file from here:
https://getbible.net/json?scripture=Psa%20119&version=bhs
I want it to look like this one:
https://www.biblegateway.com/passage/?search=Ps.119&version=WLC
But I still get only this: u05d0\u05b7\u05e9\u05c1\u05b0\u05e8\u05b5\u05d9 \u05e0\u05b9\u05e6\u05b0\u05e8\u05b5\u05d9 \u05e2\u05b5\u05d3\u05b9\u05ea\u05b8\u05d9\u05d5
I mean I want it to show all Hebrew symbols. Does anyone know how to fix that on the HTML page? Thank you.
I don't know what framework library you are using but it should be displayed correctly unless you or the library you are using escapes the unicode characters a second time ("\u05d0" becoming "\\u05d0").
var verse ={"verse_nr":1,"verse":"\u05d0\u05b7\u05e9\u05c1\u05b0\u05e8\u05b5\u05d9 \u05ea\u05b0\u05de\u05b4\u05d9\u05de\u05b5\u05d9\u05be\u05d3\u05b8\u05e8\u05b6\u05da\u05b0 \u05d4\u05b7\u05d4\u05b9\u05dc\u05b0\u05db\u05b4\u05d9\u05dd \u05d1\u05bc\u05b0\u05ea\u05b9\u05d5\u05e8\u05b7\u05ea \u05d9\u05b0\u05d4\u05d5\u05b8\u05d4\u05c3\r\n"};
document.getElementById("content").textContent = verse.verse;
<div id="content"/>
I have an application on Apache. My Apache is configured with default encoding ISO-8859, and I´m not able to change it because Apache suport others applications that need this.
Then, in my application I´m using numerical HTML encoding in special characters, like that: Usu& #225;rio (this is Usuário).
It´s working fine, but in placeholders and title (HTML5 elements), the interface is showing á ; instead to show á.
Any idea?
Thanks
You could rename your .html file to .php and add following line to the first row:
<?php header('Content-Type:text/html; charset=UTF-8'); ?>
This will send a response from server that the content which is sent is encoded in utf-8.
By adding above code nothing will be broken and you wont see any difference exept for correct encoding.
In case you need to move the site from one server to another, you can undo those steps and everything will still work as expected.
It tried to reproduce your issue with the given HTML entity and placeholder encodes the character correctly.
Resolved. I used unicode code point instead numerical HTML encoding. Take a look at UTF-8 encoding table and unicode characters here.
Other ASCII codes are doing the same thing.
Just to give you some background, these codes are part of the HTML that I'm reading from WordPress blog posts. I'm porting them over to BlogEngine.NET using a little C# WinForm app I wrote. Do I need to do some kind of conversion as I port them over to BlogEngine.NET (as XML files)?
It'd sure be nice if they just displayed properly without any intervention on my part.
Here's a code fragment from one of the WordPress source pages:
<link rel="alternate" type="application/rss+xml" title="INRIX® Traffic » Taking the “E” out of your “ETA” Comments Feed" href="http://www.inrixtraffic.com/blog/2012/taking-the-e-out-of-your-eta/feed/" />
Here's the corresponding chunk of XML that's in the XML file I output during the conversion:
<title>Taking the “E” out of your “ETA”</title>
UPDATE.
Tried this, but still no dice.
writer.WriteElementString("title", string.Format("<![CDATA[{0}]]>", post.Title));
...outputs this:
<title><![CDATA[Taking the “E” out of your “ETA”]]></title>
Since the data you are getting from Wordpress is already encoded you can decode it to a regular string and then let the XMLWriter encode it properly for XML.
string input = "Taking the “E” out of your “ETA”";
string decoded = System.Net.WebUtility.HtmlDecode(input);
//decoded = Taking the "E" out of your "ETA"
This may not be very efficient, but since this sounds like a one time conversion I don' think it will be an issue.
A similar question was asked here: How can I decode HTML characters in C#?
As I pointed out in my comment above: Your problem is that your Ü gets encoded into &8220;. When you output this in the browser it displays as Ü
I don't know how your porting works, but to fix this issue, you need to make sure that the & in the ASCII codes doesn't get encoded to &
Any chance CDATA tags solve the issue? Just make sure the text is correct in the source XML file. You don't need the ampersand magic (in the source) if you use CDATA tags.
<some_tag><![CDATA[Taking the “ out of your ...]]></some_tag>
I have an iOS 5 application that sends a job to the print que. I have all of that code working fine and I'm using the HTML formatter to create the document (UIMarkupTextPrintFormatter). Right now I have a very basic HTML string that I am using for testing but want to flesh it out further.
Which HTML engine is used to interpret the HTML string that is passed to UIMarkupTextPrintFormatter? Or, in other words, what is the best way for me to test my HTML string outside of XCode? Can I just create a text file and then view it in Safari? Would that give me the best approximation of what it will look like when printed from iOS?
How fancy can I get with the HTML in the UIMarkupTextPrintFormatter? I assume that I'll have to use all inline styles? Are there some examples out there of HTML strings that are sent to UIMarkupTextPrintFormatter to create rich documents? I just want to get an idea of what's possible with this combination.
You can test iOS printing in the Simulator, using the iOS Printer Simulator app. The UIMarkupTextPrintFormatter will render through WebKit. Imagine the HTML string is a single-page HTML document. That is basically the limitations of the formatter, although I believe you can also link to external style sheets and images too.
I'm trying to edit phpbb HTML template file with Eclipse Ganymedes version 3.4.1 containing Web Developer Tools.
These template files contain HTML markup with template variable marks in form {variable_name}. Now, when trying to open such file, Eclipse trys to validate also these template variable marks.
For example template contains
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
After opening Eclipse shows on editor body:
Unsupported Character Body
Character encoding "{S_CONTENT_ENCODING}" is not supported by this platform.
<button>Set encoding...</button>
How to solve this using WTP or is there any better editor for template editing purpose ?
Eclipse is trying to determine the text encoding from your meta tags and fails.
To override this behavior open the file in eclipse so you can see the error. Open the File menu and choose Properties (Alt-Enter) and eclipse will show you the properties dialog for the file where you can change the text file encoding.
I don't know if this can be disabled for all the files.
I've never used Eclipse on Linux, but it looks like the problem isn't really about Eclipse supporting variables -- it's about it trying to render what a character set that it thinks is called "{S_CONTENT_ENCODING}"
You can probably get around the problem by changing {S_CONTENT_ENCODING} to utf-8 (or latin-1 or whatever) in all of your templates. (This assumes that you aren't changing encoding from one template to the next, but I really doubt you are.)
Copy-paste utf-8 where you see {S_CONTENT_ENCODING} in one of the templates, and Eclipse should handle it the other {foo} instances from there.