String that starts with an emoji, and is followed with enough characters, leads to additional whitespace being added.
Looking at the code, the issue seems to be around maxNumCharsPerEncodedWord. If that limit is hit and the token starts with an emoji, an additional whitespace is added.
Also, it doesn't seem to matter where the special "token" is in the string, it will yield the same result.
Example one (working normally):
const text = "🏆 Hello!"
const encoded = rfc2047.encode(text)
const decoded = rfc2047.decode(encoded) // '🏆 Hello!'
Example two (additional whitespace added):
const text = "🏆🏆🏆🏆🏆 Hello!"
const encoded = rfc2047.encode(text)
const decoded = rfc2047.decode(encoded) // '🏆🏆🏆🏆🏆 Hello!'
Example three (additional whitespace added):
const text = "🏆1234567 Hello!"
const encoded = rfc2047.encode(text)
const decoded = rfc2047.decode(encoded) // '🏆1234567 Hello!'