I found the problem now. (after some one hour debug time) Python didn't have problem. Emacs does.
If you open a file in emacs, it will open fine regardless whether the EOL is ascii 10 or 13. (unix or mac) This is a nice feature. However, the what-cursor-position which is used to show cursor position and the char's ascii code, says the EOL is ascii 10 when it is in fact ascii 13. Fuck the irresponsible fuckhead who is responsible for this. http://xahlee.org/UnixResource_dir/writ/responsible_license.html Xah [EMAIL PROTECTED] â http://xahlee.org/ Xah Lee wrote: > Why is that some of my files written out by > outF.write(outtext.encode('utf-8')) > has ascii 10 as EOL, while others has ascii 13 as EOL? > both of these files's EOL are originally all ascii 10. > > If i remove the EOL after the tt below in the place string, then this > doesn't happen. > > findreplace = [ > (ur'</body>', > ur'''tt > </body>'''), > ] > > ... > > inF = open(filePath,'rb') > s=unicode(inF.read(),'utf-8') > inF.close() > > for couple in findreplace: > outtext=s.replace(couple[0],couple[1]) > s=outtext > outF = open(tempName,'wb') > outF.write(outtext.encode('utf-8')) > outF.close() > > thanks. > > Xah > [EMAIL PROTECTED] > â http://xahlee.org/PageTwo_dir/more.html â -- http://mail.python.org/mailman/listinfo/python-list