473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

.NET: Encoding.Convert(...Encoding.Unicode...)

Hello,
Could you help me please with encoding transformations in .NET? I am
beginner.
I have some code that nearly works - but I have problem with
converting from fileEncoding to Unicode (Strings are in Unicode).

Dim fe As Encoding 'fileEncoding
Dim ue As Encoding = Encoding.Unicode
Dim fb(0) As Byte 'bytes read
Dim ub As Byte() 'output bytes
....
fe = Encoding.GetEncoding(...) 'fe pobierane z Web.configa
....
fb(0) = br.ReadByte() 'here fb(0) > 0
ub = Encoding.Convert(fe, ue, fb) 'ERROR here: ub is null

Could you explain me please why ub does not contain Unicode bytes? How
to correct the code?
Thank you very much.
(MP)
Dec 8 '05 #1
1 2108
Mały Piotru? <ma**********@poczta.onet.pl> wrote:
Could you help me please with encoding transformations in .NET? I am
beginner.
I have some code that nearly works - but I have problem with
converting from fileEncoding to Unicode (Strings are in Unicode).

Dim fe As Encoding 'fileEncoding
Dim ue As Encoding = Encoding.Unicode
Dim fb(0) As Byte 'bytes read
Dim ub As Byte() 'output bytes
...
fe = Encoding.GetEncoding(...) 'fe pobierane z Web.configa
...
fb(0) = br.ReadByte() 'here fb(0) > 0
ub = Encoding.Convert(fe, ue, fb) 'ERROR here: ub is null

Could you explain me please why ub does not contain Unicode bytes? How
to correct the code?


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 8 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Hallvard B Furuseth | last post by:
Has someone got a Python routine or module which converts Unicode strings to lowercase (or uppercase)? What I actually need to do is to compare a number of strings in a case-insensitive manner,...
4
by: Julia | last post by:
Hi, I need to convert unicode string to ansi string Thanks in adavance.
2
by: kath | last post by:
Hi, 38938.0 <type 'unicode'> Traceback (most recent call last): File "D:\Python23\Testing area\Python and Excel\xlrdRead.py", line 30, in ?...
6
by: Aneesh E Warrier | last post by:
How can I convert Unicode Codepoint (dec) value to ASCII char? For example: 49324 is 사 a Korean alphabet, and I want to convert it to ASCII letter. Thanks!
0
by: johnlim20088 | last post by:
Hi, Hi, Can anyone tell me how to convert a set of hexcode to displayable unicode? I wish the function can display the correct value in datagrid, and when it is being export to csv, the value...
3
by: ldng | last post by:
Hi, I'm looking for a way to convert en unicode string encoded in UTF-8 to a raw string escaped with HTML Entities. I can't seem to find an easy way to do it. Quote from urllib will only work...
2
by: enginious | last post by:
Hi, I'm not sure if I'm barking up the wrong tree or not, but I gather that there could be potential security flaws by allowing unicode text to form part of an SQL query. Currently to prevent...
9
by: vaskar | last post by:
I have got one problem in VB.NET 2005 using unicode I want to add two numbers in vb.net 2005 through UNICODE I didn't know how to convert UNICODE string to integer. I hope you can solve my...
0
by: M.-A. Lemburg | last post by:
On 2008-07-01 20:31, Peter Bulychev wrote: You could write a codec which translates Unicode into a ASCII lookalike characters, but AFAIK there is no standard for doing this. I guess the best...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.