guard / listen

The Listen gem listens to file modifications and notifies you about the changes.
https://rubygems.org/gems/listen
MIT License
1.91k stars 245 forks source link

Incompatible Encoding Error with Listen-3.8.0 & Jekyll #569

Open jskyzero opened 1 year ago

jskyzero commented 1 year ago
bundle exec jekyll serve
Configuration file: /Users/jskyzero/workspace/blog/design.jskyzero.com/_config.yml
            Source: /Users/jskyzero/workspace/blog/design.jskyzero.com
       Destination: /Users/jskyzero/workspace/blog/design.jskyzero.com/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
FINISH: post-data-revision
       Jekyll Feed: Generating feed for posts
                    done in 3.502 seconds.
 Auto-regeneration: enabled for '/Users/jskyzero/workspace/blog/design.jskyzero.com'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

➜ ~ ruby --version ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]

project tree structure

find the project at https://github.com/jskyzero/design.jskyzero.com

➜ _posts git:(jekyll) tree -L 2 . ├── 日常 │   ├── chapter0 │   └── chapter1 ├── 杂谈 │   ├── 2019-05-18-penguin_and_rpg.md # for example, change this file, then crash ....


+ I change local file to fix this error, but I‘m not the expert at ruby, so i made this issue

```ruby
# Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)

# /opt/homebrew/lib/ruby/gems/3.2.0/gems/listen-3.8.0/lib/listen/adapter/darwin.rb:68:in `_process_event'

# before
rel_path = path.relative_path_from(dir).to_s 
# after
rel_path = path.relative_path_from(dir).to_s.force_encoding('utf-8')
Rasinari commented 1 year ago

Works also in ruby 3.1.3