Richard Bytheway writes: > I was having a fiddle with keyboard.xml to support a UK keyboard, and > discovered that the characters � and � (which are shift-3 and shift-<key > to left of 1>) break the XML parser. Is this intentional?
By default 8-bit XML files use Unicode UTF-8 encoding. That's the same as ASCII up to 127, but then it uses 2-, 3-, and 4-byte escape sequences to model over 60,000 more characters. For your problem, there are a couple of solutions. The easiest one might be just to declare the encoding you're using, such as ISO 8859-1 (Latin 1): <?xml version="1.0" encoding="ISO-8859-1"?> This is *not* guaranteed to be portable to all XML parsers -- some might not support 8859-1 (though most do). It will also screw anyone who wants to bind, say, Han characters from a Chinese keyboard. Another alternative is to use character entities, similar to \0nnn sequences in C strings. The Sterling character is (I think) 163 in both Latin 1 and Unicode, so you can use Here is a £ sign. and when the XML document is displayed or processed, you should see Here is a � sign. I don't remember what the value for Euro is. The final, and most elegant solution, is to configure your text or XML editor to load and save in UTF-8 format. I think you can do that with Emacs+Mule, though I haven't tried it. Note that most control characters cannot be included in XML documents at all, even with character references, no matter what the encoding. It's OK to include tab, space, newline, and carriage return, but ^L (for example) will always cause a parsing error. > Also, in the grand re-organisation of the XML files that appears to be > planned, do we need to consider a better way to handle non-US keyboard > layouts? UK is not too different, only the punctuation is rearranged, > but other european layouts move the letters around as well. What we need to do is have FlightGear read a local config file in a user directory after reading the defaults from $FG_ROOT. All the best, David -- David Megginson [EMAIL PROTECTED] _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
