0

I have a bunch of text in db that has tabs chars (\t's) in it. I want it rendered it on the web page as intended by the author. What's the right way to do that?

In other words, I'm looking for tabs analog of simple_format.

Doing <%= text.gsub("\t", "&nbsp&nbsp&nbsp") %> to achieve that doesn't seem right somehow. There has to be a more elegant railsy way.

  • Does this answer your question https://stackoverflow.com/a/2665582/4414956 ? – nuaky May 21 '20 at 08:10
  • You could use `<%= text.gsub("\t", " ") %>` https://en.wikipedia.org/wiki/Whitespace_character#Spaces_in_Unicode – max May 21 '20 at 08:14

0 Answers0