Help with putting legal XML characters into a list - InDesign

Here is a snippet of code I wrote some time ago:

global mylist
global myNewListItems
global legalChar
(*XML legal characters could also include ideograms, but that would make the following list enormous. If so inclined, please adjust the legalChar variable to include ideograms if you desire.*)
set legalChar to {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "_"}
set mynewlist to {}
global illegalNumbers
set illegalNumbers to {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
set fileType to {"IDd5"}

I’d rather use the Unicode values for xml legal characters in the legalChar list:
#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

but I’m not sure how to proceed. Do I need to use regular expressions?

Browser: Safari 533.18.5
Operating System: Mac OS X (10.6)

Since Applescript 2.0 a string, text, unicode text are all the same classes, they are all unicode text today. so checking legality could be just like this. The string allowedChars is unicode so every character is a unicode value then so no coercion is needed

set allowdChars to "ABCDEFGHIJKLMNOPQRSTUVW1234567890_"
set charToCheck to "é"
if (offset of charToCheck in allowdChars) is 0 then
	display dialog "not allowed"
end if

set allowdChars to “ABCDEFGHIJKLMNOPQRSTUVW1234567890_”
set charToCheck to “é”
if charToCheck is not in allowdChars then
end if

Thank you,this made the script a whole lot cleaner.

I was just wondering how I might make this universal, or international, so that any legal character could be used (including ideograms). I thought there might be a way of using regular expressions. I took the code above from the W3C.