What is this? This makes no sense to me.Maybe I am wrong, but you cannot assume an encoding from the length of a comment. So you introduced a bug when I use the same comment but use plain ASCII. Besides this, XeTeX support is planned for LyX 1.7, LyX 1.6 is feature frozen. So I don't understand what you tried to solve with your patch.
(btw. wasn't the rule that 2 developers have to agree?) regards Uwe