# Text does not wrap

**URL:** <https://www.ruby-forum.com/t/text-does-not-wrap/146376>\
**Category:** Rails\
**Created:** [August 20, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/text-does-not-wrap/146376 "2008-08-20T12:44:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 20, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/text-does-not-wrap/146376/1 "2008-08-20T12:44:59Z")

</div>

I need a good method for wrapping a text  
Currently I am using textual\_wrap(h(text),wrap\_length)method but it is  
not efficient some times it wrap text but some time not?  
some time it wrap text like this  
e.g-  
hhfhhf fhhfhhf hfhhffhhf  
fjfnf dmfdfdd vdvf mvfv f vf vbfn bf bfbnf  
dkbmnfb mdnmnf nd  
kjngjkg frnfkjrngrg rngjrng rkgrkg vmmrg  
rlmgr lrglrg grgmrmg

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 21, 2008, 1:08am UTC](https://www.ruby-forum.com/t/text-does-not-wrap/146376/2 "2008-08-21T01:08:04Z")

</div>

> I need a good method for wrapping a text  
> Currently I am using textual\_wrap(h(text),wrap\_length)method but it is  
> not efficient some times it wrap text but some time not?  
> some time it wrap text like this  
> e.g-  
> hhfhhf fhhfhhf hfhhffhhf  
> fjfnf dmfdfdd vdvf mvfv f vf vbfn bf bfbnf  
> dkbmnfb mdnmnf nd  
> kjngjkg frnfkjrngrg rngjrng rkgrkg vmmrg  
> rlmgr lrglrg grgmrmg

I suspect that your text may contain newline/  
's which the  
textual\_wrap is skipping over but you’re still seeing them in the  
output?

Maybe if you strip all the newlines out of your text first and then  
wrap it?

Just a guess.
