First, you would have to get the proper Encoding instance for EBCDIC, calling the static GetEncoding method which will takes the code page id as a parameter.
First, you would have to get the proper Encoding instance for EBCDIC, calling the static GetEncoding method which will takes the code page id as a parameter. Once you have that, you can set the DecoderFallback property to the value in the static ExceptionFallback property on the DecoderFallback class. Then, in your code, you would loop through each character in your string and call the GetBytes method to encode the character to the byte sequence.
If it cannot be encoded, then a DecoderFallbackException is thrown; you would just have to wrap each call to GetBytes in a try/catch block to determine which character is in error. Note, the above is required if you want to know the position of the character that failed. If you don't care about the position of the character, just if the string will not encode as a whole, then you can just call the GetBytes method which takes a string parameter and it will throw the same DecoderFallbackException if a character that cannot be encoded is encountered.
– xanatos Feb 24 '11 at 19:56 There is no . NET encoding instance for EBCDIC. – Jim Mischel Feb 24 '11 at 20:55 @Jim Mischel @xanatos: No, there is not, EBCDIC is a code page.
That is why I linked to the GetEncoding method that takes a code page as a parameter (there is a list of the code pages with code page ids for over 30 EBCDIC code pages). – casperOne? Feb 24 '11 at 22:01 Sorry.
That comment was directed at xanatos. I should have included a clarification (or reiteration) of what you said about getting an encoding for a code page. – Jim Mischel Feb 24 '11 at 0:07.
You can escape characters in Regex using the \ . So if you want to match a dot, you can do @"\. " .
To match /. _,:- for example: @"/. _,:\-\\ .
Now, EBDIC is 8 bits, but many characters are control characters. Do you have a list of "valid" characters? I have made this pattern: string pattern = @"^a-zA-Z0-9 ¢.?`:#@'=~{}\-\\" + '"' + ""; It should find "illegal" characters.
If IsMatch then there is a problem. I have used this: nemesis.lonestar.org/reference/telecom/c... Note the special handling of the ". I'm using the @ at the beginning of the string to disable \ escape expansion, so I can't escape the closing quote, and so I add it to the pattern in the end.
To test it: Regex rx = new Regex(pattern); bool m1 = rx. IsMatch(@"a-zA-Z0-9 ¢.?`:#@'=~{}\-\\" + '"'); bool m2 = rx. IsMatch(@"€a-zA-Z0-9 ¢.?`:#@'=~{}\-\\" + '"'); m1 is false (it's the list of all the "good" characters), m2 is true (to the other list I've added the € symbol).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.