Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty _site generated when using utf-8 characters #503

Closed
mmozuras opened this issue Feb 5, 2012 · 13 comments
Closed

Empty _site generated when using utf-8 characters #503

mmozuras opened this issue Feb 5, 2012 · 13 comments

Comments

@mmozuras
Copy link

mmozuras commented Feb 5, 2012

Steps to reproduce:

1 Step one:

mkdir jekyll
cd jekyll
mkdir _layouts

2 Create index.html with this content:


---
layout: default
title: Test

---
<div></div>

3 Create _config.yml with this content:

markdown: rdiscount
auto: true
permalink: pretty

4 Create default.html in _layouts with this content:

<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <title>{{ page.title }}</title>
</head>
    <body>
        <h1>Mindaugas Mozūras</h1>
    </body>
</html>

5 Run:

jekyll --server

6 Observe that _site is completely empty.
7 Delete 'Mozūras' from default layout. Repeat step 5 and find that this time _site is not empty.

I'm using:

  • MacVim/vim. Made sure it doesn't add any BOM characters.
  • Ruby 1.9.2p290
  • Jekyll 0.11.2
  • RDiscount 1.6.8

I also added this to my ~/.profile:

LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8

GitHub Pages also failed to generate new version of my site when I added an utf-8 character.

What am I missing?
Thanks in advance for your help.

@ghost
Copy link

ghost commented Feb 5, 2012

That is really weird. Are you sure that _site does not contain index.html and that this isn't a problem with your browser?

P.S. I noticed that you declared the character set twice. You only need to declare it once (<meta charset="utf-8" />).

@mmozuras
Copy link
Author

mmozuras commented Feb 5, 2012

Yes, I'm sure. I encountered this issue on a slightly bigger site, this is just a repro example. At first I was jus surprised that my site is not updating with new content (jekyll doesn't delete old _site by default). Then I looked at generated content and was surprised to find old content. I was even more surprised after deleting _site and finding absolutely no content in _site. I needed some time to find what was causing it, googling and (unsuccessfully) trying a couple of things. After that I came here and posted this issue.

P.S. Forgot to delete it from example (I didn't expect that to do anything, but I tried it anyway).

@ghost
Copy link

ghost commented Feb 6, 2012

If you delete the content in _site of course it wouldn't appear in there. The only thing I can think of at this point is to reinstall Jekyll.

@mmozuras
Copy link
Author

mmozuras commented Feb 6, 2012

What I meant - I delete _site, run jekyll --server, empty _site gets created. I remove all utf-8 characters, delete _site, run jekyll --server, non-empty _site gets created.
Also, I have the same result with GitHub Pages.

@stereobooster
Copy link
Contributor

run with --no-auto option you will see error message.

If message not clear try following: edit Gemfile

gem "jekyll", :git => "git://github.com/stereobooster/jekyll.git" 

run

bundle install
bundle exec jekyll

Also check: there is no BOM

@mmozuras
Copy link
Author

mmozuras commented Feb 6, 2012

Here's the error message:

/Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:29:in `read_yaml': invalid byte sequence in US-ASCII (ArgumentError)
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/layout.rb:31:in `initialize'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:113:in `new'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:113:in `block in read_layouts'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:111:in `each'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:111:in `read_layouts'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:97:in `read'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:38:in `process'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in `<top (required)>'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/bin/jekyll:19:in `load'
    from /Users/mindaugasmozuras/.rbenv/versions/1.9.2-p290/bin/jekyll:19:in `<main>'

29th line in convertible.rb:

      if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m

@stereobooster
Copy link
Contributor

Again: check there is no BOM. Post your file.

@mmozuras
Copy link
Author

mmozuras commented Feb 6, 2012

No BOM. I understand why you're suggesting it - I tried setting BOM (:set bomb with Vim) and deleting utf-8 character ('ū'), I get exactly the same error.

@stereobooster
Copy link
Contributor

One more idea. You set

LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8

Try locale which corresponds to this letter 'ū'

@mmozuras
Copy link
Author

mmozuras commented Feb 6, 2012

That was not it, but thanks to you I found what I missed. I'm using zsh, which doesn't load .profile. I was not aware of that and until now I stupidly never bothered to run locale to check if I actually change LANG/LC_ALL.

Thanks and sorry for wasting everyone's valuable time.

@mmozuras mmozuras closed this as completed Feb 6, 2012
@ghost
Copy link

ghost commented Feb 6, 2012

It's okay. I still love you. :D

@itaiferber
Copy link

Just want to say that I had the exact same problem, and this thread was a big help. Thanks! :)

@arunsark
Copy link

arunsark commented Aug 3, 2012

Thanks for this issue I could make jekyll work in my zsh!

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants