 	}
 
 	override var rawText: String {
-		return textStorage.string
+		// remove any attachment characters
+		let ss = "\u{ef}"
+		var str = textStorage.string.replacingOccurrences(of: ss, with: "")
+		str = textStorage.string.replacingOccurrences(of: "\u{fffc}", with: "")
+		return str
 	}
 }
 

		set { update(text: newValue) }
	}
	
	var rawText: String { return textStorage.string }

	public override var description: String { return "RmdChunk type \(chunkType) of length \(textStorage.length)" }
	

	private func attach(chunk: InlineChunk, to storage: NSTextStorage) {
		let attach = InlineAttachment()
		attach.chunk = chunk
		// FIXME: MASSIVE CODE SMELL. Shouln not need this test, but the image code crashes during unit tests
		if ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] == nil {
			let image = chunk is Equation ? NSImage(named: "inlineEquation") : NSImage(named: NSImage.advancedName)
			let acell = InlineAttachmentCell(imageCell: image)
			attach.bounds = CGRect(origin: CGPoint(x: 0, y: -5), size: acell.image!.size)
			attach.attachmentCell = acell
		}
		storage.append(NSAttributedString(attachment: attach))
	}
	
