I have a markdown file in UTF-8 without BOM encoding format[md file generated tool from word document] . Converted this markdown to HTML using jekyll tool. The following special characters available(apostrophe,hypen so on) in md file content .
1.example content in MD:
dont't, **ListView** control
Converted HTMl format like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>dont’t, <strong>ListView</strong> control</p>
</body>
</html>
We can get exact result dont’t, ListView control when open the html file. I want to use the same html file loaded in to ASP.NET MVC razor view through Html.Action. syntax given below
MVC Razor view access the html file via action method:
Html.Action("GetHtmlPage", "Products", new {path = "~/Views/Products/WhatsNew/" + Model.Platform + ".html"}))
Action code:
public ActionResult GetHtmlPage(string path)
{
return new FilePathResult(path, "text/html");
}
Using the above MVC syntax , i can successfully loaded HTMl file into my View. But the output are show below like in browser and HTMl template like previous format.
dont’t, ListView control
Apostrope viewed as', ’
 string added after bold element.
How to view the special characters in browser , when loaded html file into razor view.? I have sticking as long as today.
It appears that your HTML document is advertising itself as UTF-8. However, it if is not actually in UTF-8 format, or if the Markdown file is not in UTF-8, either could be causing the characters to not actually be UTF-8 encoded characters. So check the encodings of your files.
If that doesn't resolve the problem, then you need to use HTML Entities. Or you need to use ASCII text only for punctuation.
For example, look at the apostrophe in your sample HTML, note that it is slanted at an angle (a single right quote, unicode character U+2019) as opposed to the strait apostrophe (unicode character U+0027 - which is also an ASCII character).
Note that for those characters to display reliably in HTML documents, it is best to use the HTML Entities for those characters. Therefore, the markdown document should look this this:
Don’t, **ListView** control
The HTML entity ’ tells the browser to display a single right quote, unicode character U+2019.
Note that Markdown does not convert such characters to HTML entities for you. You have to do it yourself. You could use SmartyPants to do conversions, but it converts the ASCII characters to the richer characters as HTML entities. In that case, your Markdown should look like this:
Don't, **ListView** control
Of course, you could just use the ASCII characters and not bother with SmartPants if you want.
However, be aware that if you are using MS Word, that program is configured by default to replace the ASCII character you type (using the apostrophe key on you keyboard) with the fancy character automatically. It is generally recommended that a word processor (like MS Word) not be used for editing Markdown documents for this reason. Use a plain text editor instead.
If you really must use MS Word there are a few ways to disable the auto-replace behavior. See this for more info about how word processors act with these types of characters and how to disable that behavior.
I was having this same problem with a markdown to html converter (pandoc) and I found the solution here. Just adding the following header solved my issue:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Related
maybe trivial question but i couldnt find an answer...
When i am creating view via scaffolding this created view is saved with encoding "Central European (windows) - Codepage 1250" instead of "Unicode (UTF - 8 with signature) - Codepage 65001". I have in my layout page: charset="utf-8"
name="viewport" content="width=device-width, initial-scale=1.0"
Now i have to re-save every view with save as with encoding option and set the right encoding manually because if not some characters would be displayed in browser with questin marks.
Is it possibility to set default encoding for scaffolding of views?
This word is causing me problems. Brúðkaup
In my cms, at the top of the webpage I have this line.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
The database stores the word above as Brúðkaup and has a charset of latin1
At the top of my xml file I have the following:
<?xml version="1.0" encoding="UTF-8" ?>
Is the database using the wrong character encoding? Even if it is. Why is it that in html I specify the utf8 charset and the word shows correctly. Yet in XML I do something similar and it doesn't?
The XML is generated by PHP. I have tried to add the following in my script.
header('charset=utf-8');
This doesn't make any difference. Any ideas?
Since the data is latin1 (= ISO-8859-1 or windows-1252) encoded, it needs to be converted to UTF-8 in order to be displayed on a page in UTF-8 encoding. The tools for this depend on the software you use to get data from the database and put it into an HTML or XML document.
If the HTML file shows correctly, then either such a conversion was made at some point, or the HTML file is actually interpreted, by a browser, as latin1 encoded. This would happen if the server sends HTTP Content-Type header that specifies charset parameter to that effect – HTTP headers override meta tags.
I am here suffering from a simple, common problem.
my site is multi-language featured, built in codeigniter framework.
for eg for a french language here i have used
$lang['login'] = 'ConnÈcter';
this then appeared as Conn�cter in the view.
then i solved this by adding
<meta charset="ISO-8859-1">
which then resolved the issue.
but when the contents is loaded with characters like
Sáenz-Mata & Jiménez-Bremont
then is is changed to
Sáenz-Mata & Jiménez-Bremont
note é is changed to é even when i use
<meta charset="ISO-8859-1">
when above meta is removed, it gives me Conn�cter when the language is converted to french.
so please suggest me something which can handle both situations.
hope somebody understands it.(got messed up describing.)
thanks.
use <meta charset="utf-8">
Use UTF-8 consistently for all pages, as explained in the CodeIgniter User guide. Make sure the encoding of each file matches its declared encoding. What you are experiencing now is caused by mixing encodings (UTF-8 and ISO-8859-1 mostly).
As title says. Story is, I've changed meta mark-up of my _Layout.cshtml page from:
<meta charset="utf-8" />
to
<meta content="text/html; charset=utf-8">
Effect? No Polish characters on page. Ok, let's revert the change. Effect? No Polish characters on page.
Btw it affects ONLY _Layout.cshtml, all other views show Polish letters properly. Proper letters are replaced by "Ĺ‚" characters.
Any ideas? Thought about changing browser, but it didn't work. Same stuff happens on different computer.
No other changes were made. Tried to revert project to older version from repository, didn't work.
Opened in notebook and saved again wit UTF-8 encoding set. Worked.
I quite like that WMD is behaving nicely with my app. However, I have one problem.
Basically I edit content and store it as markdown in my database. Then I use Kramdown to get the HTML for the views. However Kramdown gets me the HTML tags which are not read by my browser. I use Chrome.
Sanitizing it will give a plain text even when the user has entered e.g. bold, italic, code etc.
So the basic idea is to get the generated HTML read as HTML and as 'rich-text'.
Inspecting the output source, I find that if I use Kramdown::Document.new(text).to_html there are some " " quotes introduce like this: "<p> ...<em>..</em>.. </p>"
These quotes hide the really HTML code after the quotes...(I assume)
and with sanitize the quotes are gone: <p> ...<em>..</em>.. </p> but I end up with plain text.
What am I missing here? Can I make my browser see that I have bold, or i have italic, a paragraph, an image etc...
Must I use kramdown or similar markdown to HMTL converters?
Thanks a lot!
UPDATE
I use compass for my stylesheets. When compass is uninstalled WMD editor works fine and correctly. For some reasons, it seems, compass hides any styles including 'test text' in my application.html.erb file but those created with its .scss partials files! I mean for example the following code when written in my application.html.erb file does not display as bold. <strong> test bold </strong>
Any ideas why this happens?
I have figured out the solution.
The problem was that the generated compass styles includes the following code segment:
body.bp {
#include blueprint-typography(true);
#include blueprint-utilities;
#include blueprint-debug;
#include blueprint-interaction;
// Remove the scaffolding when you're ready to start doing visual design.
// Or leave it in if you're happy with how blueprint looks out-of-the-box
}
In my stylesheets I had ignored to include the .bp class. All is good now...