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

feat: basic escaping support #713

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

bd82
Copy link

@bd82 bd82 commented Feb 2, 2023

This PR implements basic escaping support as implemented in the Ruby Gem

I have attempted to align the code style / logic components with the Ruby Gem.
Based on the assumption that this is the "source of truth" (pseudo spec) for this library.

I personally think other implementations of dotenv have more complete (better?) support for escaping and
expanding special characters (Example Spec).

But I wanted to start with the minimal viable scope and avoid misalignment with the "source of truth" (?)

resolves #711

@motdotla motdotla force-pushed the master branch 4 times, most recently from 01fa9ef to ef48935 Compare May 30, 2023 16:15
@@ -23,9 +23,9 @@ t.equal(parsed.DOUBLE_QUOTES_SPACED, ' double quotes ', 'respects surround

t.equal(parsed.EXPAND_NEWLINES, 'expand\nnew\nlines', 'expands newlines but only if double quoted')

t.equal(parsed.DONT_EXPAND_UNQUOTED, 'dontexpand\\nnewlines', 'expands newlines but only if double quoted')
t.equal(parsed.DONT_EXPAND_UNQUOTED, 'dontexpandnnewlines', 'expands newlines but only if double quoted')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have mixed feelings on this behavior. looks like the rubygem has done this since inception, but it doesn't follow the principle of least surprise to me. the \n disappearing would frustrate me.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this behavior goes back to 0.0.3. 599144a

i'm open to arguments for doing this, but it will definitely be a potentially significant breaking change if we do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supporting Escape Sequences
2 participants