decoding byte array
am 23.11.2007 02:32:00 von Paulhow do i decode a byte array using getstring, if i don't know which encoding
was used to write it?
how do i decode a byte array using getstring, if i don't know which encoding
was used to write it?
>how do i decode a byte array using getstring, if i don't know which encoding
>was used to write it?
That would be pretty hard to do if there's no BOM or other indicator.
You'd probably have to try to figure it out one way or another.
The Windows API offers the function IsTextUnicode which does some
guessing about whether or not a string is in a unicode format or not,
but it's not perfect.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
ok thanks
"Mattias Sjögren" wrote:
> >how do i decode a byte array using getstring, if i don't know which encoding
> >was used to write it?
>
> That would be pretty hard to do if there's no BOM or other indicator.
> You'd probably have to try to figure it out one way or another.
>
> The Windows API offers the function IsTextUnicode which does some
> guessing about whether or not a string is in a unicode format or not,
> but it's not perfect.
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
>
..paul. wrote:
> how do i decode a byte array using getstring, if i don't know which encoding
> was used to write it?
Is there no way of changing the problem to "how do I guarantee that I
know what the encoding is"?
--
Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/