Could you paste the actual working code you used to get the example working properly?
import os
import arcpy
tbl = arcpy.CreateScratchName("","","table","in_memory")
arcpy.CreateTable_management("in_memory",os.path.basename(tbl))
arcpy.AddField_management(tbl,"TESTFIELD","TEXT")
Rows = arcpy.InsertCursor(tbl)
Row = Rows.newRow()
Rows.insertRow(Row)
del Row, Rows
arcpy.CalculateField_management(tbl,"TESTFIELD","chr(10) + chr(13)","PYTHON_9.3")
print arcpy.GetMessages()
Rows = arcpy.SearchCursor(tbl)
Row = Rows.next()
print "Field value: ",repr(Row.TESTFIELD)
del Row, Rows
Results:
Executing: CalculateField in_memory\xx0 TESTFIELD "chr(10) + chr(13)" PYTHON_9.3 #
Start Time: Mon Aug 05 10:49:33 2013
Succeeded at Mon Aug 05 10:49:33 2013 (Elapsed Time: 0.00 seconds)
Field value: u'\n\r'
Also this worked fine for me:[ATTACH=CONFIG]26465[/ATTACH]I think the problem you're running into is using the value of the field !TESTFIELD! if the field contains newlines - the tool will substitute in the value of the field into the expression - the geoprocessing messaging and Python interpreter can't deal with this.I think the method you found is a good approach, that is, using Python with cursors (using the Calculate Value tool if in ModelBuilder) instead of using Calculate Field. I don't see another way around this, which is a design issue with the way Calculate Field accesses field values, and its connection with the geoprocessing message environment in how things are passed to Python. Seems to me this is a good enhancement request for Calculate Field, i.e. have non printables converted to escape codes as part of the !FIELDNAME! -> value substitution process.