Is there anyway i can use some custom encoding or convert some base16 characters (two bytes chars as in japanese SHIFT-JIS) when reading them using binaryreader ? i mean, while
I think you want to implement your own Encoding and Decoding, so the problem is related to how you implement them, that depends on your algorithm. The default Encoding
supports only popular encodings such as Unicode, BigEndianUnicode, UTF-8, ...
. I suggested that you don't need any kind of custom Encoding, as you can see Encoding
is just a class with some methods to perform the actual encoding
and decoding
, it helps you a lot in handling with the well-known, popular encodings Unicode
, ... but for your own Encoding, you must implement almost all the core functions like this:
public class CustomEncoding : Encoding
{
//NOTE: There are some abstract members requiring you to implement or declare in this derived class.
public override byte[] GetBytes(string s)
{
//Your code goes here
}
public override string GetString(byte[] bytes)
{
//Your code goes here
}
//And many other virtual (overridable) methods which you can override to implement your custom Encoding fully
}
Hope it helps!