# Mod\_strip newline substitution problem

**URL:** <https://www.ruby-forum.com/t/mod-strip-newline-substitution-problem/136343>\
**Category:** NGINX\
**Created:** [May 1, 2008, 1:14am UTC](https://www.ruby-forum.com/t/mod-strip-newline-substitution-problem/136343 "2008-05-01T01:14:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Calomel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@Calomel](https://www.ruby-forum.com/u/Calomel)\
**Post date:** [May 1, 2008, 1:14am UTC](https://www.ruby-forum.com/t/mod-strip-newline-substitution-problem/136343/1 "2008-05-01T01:14:42Z")

</div>

@Evan M.

I built Nginx 0.6.30 with the third party module mod\_strip. The problem  
I  
am seeing is when mod\_strip removes a newline “\n” it does not replace  
it  
with a space. Instead, the last word of one line is jammed next to the  
first word of the next line. If it helps I am writing the HTML files by  
hand using the editor, “vi”.

For example, The following text is on two lines and entered as:

This is a test  
Allow me to explain

When mod\_strip encounters the newline at “test\n” then both lines are  
joined, but the words “test” and “Allow” are jammed together:

This is a testAllow me to explain

Perhaps when a newline is seen mod\_strip should add a space and check  
for  
double spaces afterward?

BTW, everything else mod\_strip touches is formated correctly and I have  
had  
no issues with any other facet of the program. If there is a fix I would  
be  
happy to test it.

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![Calomel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@Calomel](https://www.ruby-forum.com/u/Calomel)\
**Post date:** [May 2, 2008, 9:48pm UTC](https://www.ruby-forum.com/t/mod-strip-newline-substitution-problem/136343/2 "2008-05-02T21:48:31Z")

</div>

The problem is that I can’t replace newlines before end tags with a  
space:

[http://www.emf.net/~estephen/htmlner/whitespacebugs.html](http://www.emf.net/~estephen/htmlner/whitespacebugs.html)

Unfortunately mod\_strip doesn’t support look-ahead. When it encounters a  
newline, it has to decide what to do with it before examining subsequent  
characters (that is, before examining whether the newline precedes an  
end  
tag).

Short of rewriting to support look-ahead, maybe I could support options:

location … {  
strip on;  
strip\_characters tabs spaces newlines;  
}

By default perhaps newlines shouldn’t be processed. What do you think?  
In  
any event, I will update the docs to reflect this bug.

Thanks,

Evan
