RE: [xml] final output filtering?



  Okay, okay ...
My goal is not to make it harder for non Unix. I would just like
to make sure what used to compile and work fine still does. 
So basically
I'm not sure I can trust the b flag of fopen() to not break. 
Point is that
if it break all file I/O stops and hum ... that's a bit inconvenient.

Hehe, if that is an 'inconvenience', then a 'showstopper' is nothing short
to the sun going nova. :-)

Keeping the #ifdef sounds safer, now if Igor can spot the place where
the "wb" instead of "w" is needed and commit it that would be 
great :-)

Sure I can do that, but how many will put my picture on the wall and throw
darts at it if I do it?

Right now libxml writes \r\n files to the disc on Windows. Libxml serialises
\n, and the runtime adds a \r. Doing a xmlParseFile and then xmlSaveFile
effectively converts \n files to \r\n ones. Using "wb" instead of "w" would
reverse the situation, namely a \r\n file would end up converted to \n after
you use the function pair above. I believe quite a few would wish me harm
after such a change.

  But, there is a reason to do it. If you are an american, sworn to
ISO-8895-X, then things will work fine without "wb" until...
  ... until someone forces you to use a multibyte-enconding, with the
current locale set to en_US.ISO-8859-1. When you namely request libxml to
output a file in, say, UTF-16BE or perhaps SHIFT-JIS, fwrite will never
know. Fwrite will examine the output stream byte-for-byte and insert a 0x0d
before every 0x0a. That will, at best, destroy every character which
contains a 0x0a somewhere in it's multibyte sequence. If UTF-8 has such
characters, then it will be screwed up as well. 

I think that installing an editor which can handle \n files is less pain
than dealing with this kind of mess once it comes. My files are all in the
very basic ASCII, using character references such as ö for everything
not covered by ASCII. I won't break either way. Precisely that does not
allow me to decide if it should be a "wb" or a "w" without hearing those to
whom this is relevant.

I would know, how many of you who listen would know misery if I put "wb"
instead of "w"?

Ciao,
Igor



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]