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

Missing many escape sequences in template strings #1393

Open
TwitchBronBron opened this issue Jan 7, 2025 · 0 comments
Open

Missing many escape sequences in template strings #1393

TwitchBronBron opened this issue Jan 7, 2025 · 0 comments
Labels

Comments

@TwitchBronBron
Copy link
Member

BrighterScript is not properly handling all common escape sequences correctly. For example, the tab sequence \t is escaping to literal char code 116 which is the t character.

Image

We should support the same escape sequences as in javascript. Some of the sequences from that link are unnecessary due to how brightscript strings, so here's the revised list of what needs to be supported in brighterscript template strings:

Escape sequence Unicode code point
\0 null character (U+0000 NULL)
\\ backslash (U+005C REVERSE SOLIDUS)
\n newline (U+000A LINE FEED; LF)
\r carriage return (U+000D CARRIAGE RETURN; CR)
\v vertical tab (U+000B LINE TABULATION)
\t tab (U+0009 CHARACTER TABULATION)
\b backspace (U+0008 BACKSPACE)
\f form feed (U+000C FORM FEED)
\` backtick char (U+0060 UNICODE CHAR “`”)

Am I missing anything?

This is probably a breaking change, but I full expect that developers who typed \t intended to insert a tab, so we could probably just fix this in the v0 line with minimal risk.

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

No branches or pull requests

1 participant