-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fix watcher failure due to incorrect file name encoding #78
Conversation
e13515f
to
17ad66c
Compare
This still breaks watching on Windows and source at
|
@ashmaroli this PR focuses on files inside the source dir, fine by me, but we need to add a test. |
@DirtyF I agree this fix is legit for watching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a test checkin' this, especially if we want Jekyll 4 to properly handle i18n.
17ad66c
to
262af9d
Compare
When the watched file name isn't US-ASCII encoded (i.e. UTF-8) the watcher will fail due to error when file modification is made: ``` processing events: U+6211 from UTF-8 to US-ASCII Backtrace: [2018-10-13T15:17:43.736524 #83757] ERROR -- : exception while processing events: U+6211 from UTF-8 to US-ASCII Backtrace: -- .rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jekyll-watch-2.1.1/lib/jekyll/watcher.rb:71:in `encode!' -- .rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jekyll-watch-2.1.1/lib/jekyll/watcher.rb:71:in `block in normalize_encoding' -- .rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jekyll-watch-2.1.1/lib/jekyll/watcher.rb:71:in `map' -- .rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jekyll-watch-2.1.1/lib/jekyll/watcher.rb:71:in `normalize_encoding' -- .rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/jekyll-watch-2.1.1/lib/jekyll/watcher.rb:59:in `block in listen_handler' ```
262af9d
to
5778ee3
Compare
Having thought about it a bit, I think the fix I made previously was wrong. The issue codes was outputting file path info to the console, and therefore, it is the encoding of the file name that we are working with, not the encoding of file content. The previous fix incorrectly encodes the file name encoding with the content encoding specified in the Jekyll config. I change my commit to fix this issue with a different approach which avoids the need for encoding conversion altogether. I have also added a new post file with Chinese file name for test purpose. @ashmaroli Could you check if the fix works on your machine? Thanks! |
@stkao05 You have effectively replaced the fix introduced in #69 with a better alternative. The issue I noted in #78 (comment) is still present but that shouldn't be a concern.. Great Job!! 👍 💯 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 For a better alternative
@DirtyF I'm dismissing your "Approval" and requesting a re-review of the "current implementation".. |
Branch content changed significantly since approval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works on my end.
@jekyllbot: merge +fix |
When the watched file name isn't US-ASCII encoded (i.e. UTF-8), the watcher will raise error when file modification is made:
The issue is fixed by avoiding the need for encoding conversion when watcher outputting log to the console.
Steps to reproduce
bundle exec jekyll serve
)