You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/08/26 14:49:30 UTC
DO NOT REPLY [Bug 22729] New: -
Normalization of LF to CR/LF broken in FormatterToText
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22729>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22729
Normalization of LF to CR/LF broken in FormatterToText
Summary: Normalization of LF to CR/LF broken in FormatterToText
Product: XalanC
Version: 1.6
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: XalanC
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: claire.chauvet@neolane.com
FormatterToText does not normalize LF when it was asked to do it.
A quick look at FormatterToText::characters (line 193 in
src/xalanc/XMLSupport/FormatterToText.cpp) should be sufficient to conclude it
cannot work.
I fixed the bug like this:
void FormatterToText::characters(const XMLCh* const chars,
const unsigned int length)
{
assert(m_writer != 0);
if (m_normalize == false && m_haveEncoding == false)
{
m_writer->write(chars, 0, length);
}
else
{
unsigned int i = 0;
while(i < length)
{
if (chars[i] > m_maxCharacter)
{
//$$$ ToDo: Figure out what we're going to do here...
}
#if defined(XALAN_NEWLINE_IS_CRLF)
if( m_normalize )
{
// Normalize LF to CR/LF...
if( chars[i] == XalanUnicode::charLF &&
(i == 0 ||
chars[i - 1] != XalanUnicode::charCR))
{
m_writer->write(m_newlineString, 0, m_newlineStringLength);
++i;
continue;
}
}
#endif
m_writer->write(chars[i]);
++i;
}
}
}