Here's a string:
"Hello\r\nHow are you?"
I saved this string into my DB two ways:
1) by copying this exact string into the console then saving;
2) by typing it (with an actual newline rather than \r\n
) into the object's form and submitting it.
Both results return the above string on the console. Both are encoded in UTF-8.
However, only the first responds to .ascii_only?
with true
.
- Why is this the case? How can I save the above string as ascii_only with method #1?
- How can I convert method #1's string to
ascii_only?
?