Reputation: 31345
Apparently Cloud Firestore console does not display newline characters inside strings. Is there a way to inspect them?
This string saved is actually:
QUESTION
Can I be sure that the newlines are there, even though they're not visible on the Firestore Console?
Upvotes: 11
Views: 7507
Reputation: 171
Replace the loaded string '\\n' with '\n' in the program and you can add '\n' in the database:
text.replaceAll('\\n', '\n');
Upvotes: 1
Reputation: 105
The method I have been using is to save the text in URL encoded format and decode it in your app or website. This method is good since URL encoding converts newlines, spaces and tabs to characters which are safe for transmitting over Internet.
Upvotes: 0
Reputation: 598740
Strings are stored unmodified, but various parts of the Firestore console show the newline character in different ways. Also see my previous answer on Firebase Firestore new line command and Doug's answer here: New Line Command (\n) Not Working With Firebase Firestore Database Strings.
Since the behavior is confusing to you, please file a bug report. But rest assured: your newline characters are stored and read correctly.
Upvotes: 3