Assume UTF-8 encoding for .markdown and .haml - using new Git.readFile functionality#31
Open
pirxpilot wants to merge 1 commit intocreationix:masterfrom
Open
Assume UTF-8 encoding for .markdown and .haml - using new Git.readFile functionality#31pirxpilot wants to merge 1 commit intocreationix:masterfrom
pirxpilot wants to merge 1 commit intocreationix:masterfrom
Conversation
Reads .markdown, .haml and snippets as "utf8" Everything else is read as raw buffers - no conversion needed.
Owner
|
Why not read everything as buffers. They automatically toString to utf8 strings when coerced. |
Author
|
I had another look. I am pretty sure my patch loads them as strings (i.e. explicitly passing 'utf8' encoding) only when they are used as strings. The results of Git.readFile are passed to 'Haml.compile' and various string methods (substr, match etc.) are called on them: I don't think such usage triggers implicit coercion. There was actually one explicit conversion that I was able to remove from prepareMarkdown: After reading your comment I experimented with loading everything as buffers and wheat predictably breaks in couple of places. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only pull after new version of git-fs is published to npm.
This should fix encoding problems #18, #28 etc.
Tested with howtonode.org - seems OK.
Reads .markdown, .haml and snippets as "utf8"
Everything else is read as raw buffers - no conversion needed.