Yes. Except that you would need to use a dirrerent encoding to handle
characters that is not in the ASCII character set, like UTF8.
Göran Andersson ha scritto:
> Yes. Except that you would need to use a dirrerent encoding to handle
> characters that is not in the ASCII character set, like UTF8.
I can compress and decompress Array of bytes but I can't do this if I
dump the interrmediate compress byte() in a string. I'm using
encoding.unicode.getstring to dump the intermediate compress byte() on
a string and I'm using encoding.unicode.getbytes to get the array of
bytes to be uncompressed.
I can't get the result 'cause Deflate.Read(..) returns zero; I noticed
that when I try to dump the compressed byte array on a string, I get
less char as I forecast: CompressedBuffer.length = 119 while
CompressedString.Length = 57 using
Dim CompressedString As String =
Encoding.Unicode.GetString(CompressedBuffer).
I expected CompressedString.Length = CeilingUpper(119/2) = 60.
I'm using unicode compression in order to get a String with Char in
Unicode coding 'cause I need 2 bytes per char and storing a number 0 to
65535 in each char. Then I dump the this Unicode coded string on a
field of a db.
Any ideas? How could I dump the compressed array of bytes on an
intermediate string?
> > Hi!
> > Did you mean System.Text.Encoding.ASCII.GetBytes as the following code
[quoted text clipped - 16 lines]
> >>> Hi!
> > [...]
Robert - 15 Nov 2006 10:27 GMT
Have you checked out System.String.Intern? I saved about 30% using this in
a
geocoder with millions of street names.
No compression required..
Göran Andersson - 16 Nov 2006 23:59 GMT
If you have some binary data in an array, you can't just treat it as if
it was an encoded string, because then you will lose some data when it's
decoded.
If you want a string representation of binary data, you can use the
Convert.ToBase64String and Convert.FromBase64String methods to convert
to and from a base 64 string.
> Göran Andersson ha scritto:
>
[quoted text clipped - 41 lines]
>>>>> Hi!
>>> [...]