pygments / pygments.rb

💎 Ruby wrapper for Pygments syntax highlighter
MIT License
572 stars 141 forks source link

utf-8 on windows #96

Closed robert-hoffmann closed 3 years ago

robert-hoffmann commented 10 years ago

Hi,

Jekyll on windows breaks. This has been tracked to pygments > 0.5.0 breaking, see here https://github.com/mojombo/jekyll/pull/1487#issuecomment-27040718

Any ideas or updates to this, since building github pages on windows is probably something many people want to do, and utf-8 (at least for me) has pretty much become standard as far as generating internationalized files go (actually i just utf-8 EVERYTHING ..html, js, txt, css).

Thanks, Robert

robert-hoffmann commented 10 years ago

Tested pygments 0.5.4 on windows, here is the result

install

F:\Github\home\headjs>gem install pygments.rb
Fetching: pygments.rb-0.5.4.gem (100%)
Successfully installed pygments.rb-0.5.4
1 gem installed
Installing ri documentation for pygments.rb-0.5.4...
Installing RDoc documentation for pygments.rb-0.5.4...

_config.yml (to have same as github)

# GitHub Defaults
lsi: false
pygments: true
safe: true

# UTF-8 & parse errors fix
markdown: redcarpet

build

F:\Github\home\headjs>jekyll build
Configuration file: F:/Github/home/headjs/_config.yml
            Source: F:/Github/home/headjs
       Destination: F:/Github/home/headjs/_site
      Generating... C:/Ruby193/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162: warning: cannot close fd before spawn←[31m  Liquid Exception: No such file or directory - /bin/sh in index.html←[0m done.

Seems more like a path problem. Switching to redcarpet on windows resolves the UTF-8 problems.

Would be nice to be able to upgrade to pygments 0.5.4 to get rid of the python dependencies :-)

VirtueMe commented 10 years ago

I got the the same issue running jekyll on windows x64 and Ruby 2.0.0-p247 x64. I cloned Jekyll Bootstrap. I had 1 warning when I ran bundle install.

Parsing documentation for redcarpet-3.0.0
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/redcarpet.so, skipping

But my site ran fine locally and the error came first after I tried to get gfm to work by adding this line to the config:

markdown: redcarpet
C:\github\virtueme.github.io [jb +2 ~3 -1 !]> jekyll serve
Configuration file: C:/github/virtueme.github.io/_config.yml
            Source: C:/github/virtueme.github.io
       Destination: C:/github/virtueme.github.io/_site
      Generating... C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162: warning: cannot close fd before spawn
  Conversion error: There was an error converting '_posts/core-samples/2011-12-29-jekyll-introduction.md'.
done.
    Server address: http://0.0.0.0:4000
  Server running... press ctrl-c to stop.

PS: Downgrading to pygments.rb 0.5.0 and installing python 2.7 (python 3.3 didn't fix the issue) fixed this issue for me.

robert-hoffmann commented 10 years ago

I also use utf-8 encoding as the default in all my files, so i have to use:

* ruby 1.9.3
* pygments 0.5.0
* python 2.7
* and switch markdown to redcarpet

Window 8.1 Pro, x64

slonopotamus commented 3 years ago

Unfortunately, Jekyll dropped pygments.rb support: https://github.com/jekyll/jekyll/issues/6823