Patent ID: 8156432

Claim:
A method, comprising automatically determining a UTF-16 encoding scheme, wherein automatically determining a UTF-16 encoding scheme, comprises: receiving the incoming data stream; storing a current encoding status of the incoming data stream; monitoring the incoming data stream for the presence of a 0x3C byte; when a 0x3C byte is identified, determining if a byte following the 0x3C byte is a null 0x00 byte; and if the byte following the 0x3C byte is a null 0x00 byte and if the current encoding status is not UTF-16LE, then: determining if a byte before the 0x3C byte is a null 0x00 byte; if the byte before the 0x3C byte is a null 0x00 byte, then begin processing the incoming data stream as UTF-16BE and storing the current encoding status of the incoming data stream as UTF-16BE; and if the byte before the 0x3C byte is not a null 0x00 byte, then begin processing the incoming data stream as UTF-16LE and storing the current encoding status of the incoming data stream as UTF-16LE; else, if the byte following the 0x3C byte is a null 0x00 byte and if the current encoding status is UTF-16LE, then: determining if the two bytes before the 0x3C byte are null 0x00 bytes; if the two bytes before the 0x3C byte are null 0x00 bytes, then begin processing the incoming data stream as UTF-16BE and storing the current encoding status of the incoming data stream as UTF-16BE; and if the two bytes before the 0x3C byte are not null 0x00 bytes, then begin processing the incoming data stream as UTF-16LE and storing the current encoding status of the incoming data stream as UTF-16LE; else, if the byte following the 0x3C byte is not a null 0x00 byte, then using an XML encoding tag determining the current encoding status of the incoming data stream from an encoding scheme identified in the XML encoding tag, begin processing the incoming data stream according to the encoding scheme identified in XML encoding tag, and storing the current encoding status of the incoming data stream as the encoding scheme identified in the XML encoding tag.