i have been working on jekyll on my personal website and for my blogs, i have come across a problem with UTF-8 encoding.
It works perfectly on my local machine but it doesn't work well in production.
https://github.com/freedomgw/thehacklife/blob/gh-pages/_posts/2013-12-14-the-power-of-ajax.md
This is what it actually looks like on live..
http://thehacklife.com/posts/the-power-of-ajax/
I am just not entirely sure how to fix this on github pages... since github are the ones hosting the site. Also, I am using sublime and I am saving it in UTF-8 encoding in markdown format.
Any suggestions are appreciated
I had the same issue. My apostrophes were showing up as ’ .
The solution is to declare the encoding explicitly with <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
I had the same issue with new posts (auto-converted old ones worked fine, though). The resolution was to add
layout: post
inside the post.markdown file; example:
---
title: 'My title'
layout: post
---
page content
This will automatically add the UTF-8 charset header mentioned in the other answer / comment.
Related
So I faced a problem while trying to add some SEO optimization for my simple static website served via Github Pages.
As the documentation says: https://help.github.com/articles/search-engine-optimization-for-github-pages/
I created the _config.yml file which includes next lines of code:
plugins:
- jekyll-seo-tag
and pushed this file along with my website files, so the structure looks like this
The problem is that after linking to my website I see the
output
And the head tag includes following content
I need help in understanding why the SEO plugin doesn't work. Thanks for all your replies and have a nice day!
If you want any file to be processed you must add a front matter to it.
Your index.html must be like :
---
# even an empty front matter is ok
---
<!DOCTYPE html>
...
David Jacquel's answer helped so much and I managed to resolve a problem. More about that:
I had to inject a valid front matter to resolve a problem e.g.
---
layout: main
title: Cheaterino
---
After that I still didn't manage to deal with the problem since my index.html was minified and so do the front matter.
After I disabled minification of the file everything worked!
head tag content after plugin worked
Thanks so much to David Jacquel!
I am building my homepage with jekyll and github-pages.
All is going fine, including the permalink of the markdown files in the submodule of my repository.
However: there is one page that is not showing at the permalink address:
build page: https://atlassianps.github.io/docs/ConfluencePS/
source page: https://github.com/lipkau/ConfluencePS/blob/0750be31ebed41e3613f8ccba7173c184e869217/docs/commands/about_ConfluencePS.md
What am I doing that is keeping that permalink from working?
Thanks
see the way it is rendered on GitHub..
ensure that:
there is absolutely nothing before the front matter dashes
you're file is saved properly with UTF-8 encoding.. i.e. there is no BOM characters there.
i'm entirely new to github pages and jekyll and yaml and i've run into some problems while creating my very first project. I suspect the problem lies with the _config file but I have no idea what it is. If you take a look at my site mohmanyang.com, you see that the yaml is rendered as text instead of being replaced with code from the "default.html" which can be found in the _layouts folder. Here is the project on github, any help will be appreciated.
I guess that you're developing on Windows and that your editor is saving files with utf-8 with BOM.
Jekyll doesn't like BOM. Saving you files with utf-8 with no BOM will make the magic.
I spent the last few hours getting my website to validate HTML 4.01 Strict and I actually have succeeded in that, but there is still one warning which I can't get rid of. The warning is:
Character Encoding mismatch!
The character encoding specified in
the HTTP header (iso-8859-1) is
different from the value in the
element (utf-8). I will use the value
from the HTTP header (iso-8859-1) for
this validation.
The page in question is www.dubiousarray.net/default.html. As you can see from the page source I have the following meta element:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
and I have made sure that the default.html file is saved with UTF-8 encoding. The strange thing is all the other pages in the site validate without this warning and they have the same meta tag and were saved in exactly the same way. I am pretty sure it is something to do with the server configuration. The .htaccess file looks like this at the moment:
# Use PHP 5 as default
AddHandler application/x-httpd-php5 .php
AddDefaultCharset UTF-8
But I have tried all the fixes shown on this page and none of them worked. How can I go about getting rid of this warning?
In Firefox, if you right click on the page and select 'View Page Info', default.html shows as ISO-8859-1, while all the other pages show UTF-8.
All the html file have been created and saved in the exact same way (character encoding set to UTF-8 without BOM), but default.html is the only one which isn't displaying as UTF-8. So I assume the server is doing something special to the default.html file though I am not sure what as there is not sign of it in the .htaccess file.
You need to replace the HTTP-level header.
This should work:
<?php
header('Content-type: text/html; charset=utf-8');
?>
Note that the above must be the first thing in your file. No exceptions. See header.
For general information on how to change the character set header in different web stacks, see Setting the HTTP charset parameter.
The server is clearly marking the document as ISO-8859-1 in the HTTP headers. Try saving default.html using UTF-8 encoding with a proper editor.
Include this in your code:
<meta charset="utf-8" />
Okay, I have come up with a partial solution to my problem. As it was only the default.html file which was causing the warning I assumed that the server was doing something special to it because of its name. So I made a new file called home.html with the same contents as the default.html file and pointed the .htaccess file to the new file (see line 3 below).
# Use PHP5 as default
AddHandler application/x-httpd-php5 .php
DirectoryIndex home.html
AddDefaultCharset UTF-8
This fixed the problem and all files are now recognised as UTF-8. I'm still not sure what the server was doing to the default.html file or where the settings concerning that are, but as my problem is gone I will forget about that.
Remove AddDefaultCharset from .htaccess and check the encoding.
I saved the HTML source of your webpage and opened it. Encoding was detected as UTF-8. However, on viewing the same webpage served by your web server, the encoding is ISO-8859-1. That is why I suggest removal of the former redundant rule.
I created a static website in which each page has the following structure:
Common stuff like header, menu, etc.
Page specific stuff in main content div
Footer
In this website, all the common content is duplicated in each page. In order to improve the maintainability I refactored the pages to use server-side includes (SSI) so that the common content is not duplicated. The structure of each page is now
SSI for Common stuff like header, menu, etc.
Page specific stuff in main content div
SSI for footer
In the refactored site, for some reason the French characters no longer display properly in the page-specific content area, though they display fine in the content included via SSIs.
The included header specifies the character set as:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
If I open one of the main content pages in a browser it tells me that the character encoding is ISO-8859-1. I've tried adding a .htaccess file to the folder with the lines
AddDefaultCharset UTF-8
AddCharset UTF-8 .shtml
AddCharset UTF-8 .html
But still those pesky French accents aren't displaying properly on the version of the site that uses SSIs.
You are serving your pages as UTF-8, which is good, but at least some of the page is being dragged in from files which are not actually saved as UTF-8. SSI just throws the raw bytes in, it doesn't attempt to recode the includes so that their charsets match the file they're being included into.
You need to go through all your html and include files in a text editor and make sure each one is saved as UTF-8.
As John mentioned, you can avoid encoding issues by using character references for all non-ASCII characters, but it's a tremendous pain.
Your HTML document is using UTF-8 encoding, try these character codes for your accented letters: http://www.tony-franks.co.uk/UTF-8.htm
I had the same problem as you and finally found a solution that fixed it.
UTF8 makes an extra line on my site
Save all your files as UTF-8 without BOM (http://en.wikipedia.org/wiki/Byte_order_mark).