escaping \n inside TEXT field
See original GitHub issueI have a text field that contains \n
. When I access my data via Hasura, it adds extra slash to it resulting: \\n
.
I tried couple of ways to work around it like adding /\n
but that resulted to /\\n
.
All I need to have my text exactly the way I inserted but I assume as you convert value to json friendly, it escapes.
Any idea how I can work around it? (Not sure if it is intended or a bug)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How can you process a newline escape sequence "\n" in a ...
Newline sequences work fine in Text("hello\nworld") but will simply display the "\n" instead of a newline if used with TextField.
Read more >Text Field Escape Codes - Documentation - Knowledge Base
Text fields marked with a console/terminal icon can contain backslash-style escape codes for encoding newlines, carriage returns, ...
Read more >Preventing escaped characters in TextField - Unity Forum
I have a visual tree containing several TextField elements. One of these elements is intended to include a directory path.
Read more >Escape Sequences
An escape sequence is a set of characters used to insert into a string certain ... Note: The \n escape sequence works only...
Read more >' --> ' changes to ' --> ' inside a text field
Writing "-->" in a string field, corrupts the content with escaped HTML characters. If you enter in the text: '-->', for example in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah—the issue you’re having is that Postgres does not support
\n
escapes in ordinary string literals (because SQL does not). So when you writeyou’re actually inserting a string with the character sequence “backslash n backslash n” into your database, not a string with newlines. If you want to include newlines in string literals, you can use “‘escape’ string constants,” which are prefixed with the letter
E
. For example,will do what you want.
How we do it in hasura query ?