How to convert a string from one encoding to another

I have a string in one known encoding and I need to convert it to another.

How to do this most easily?
Thanks for thy help, Hooker
2/27/2004 4:31:55 PM 91979 articles. 4 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 22

Can you state the "encodings" you are using? There are a number of types.
--- Peter Blum
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
2/27/2004 7:13:42 PM
Thanks for your interest.

Well, I will explain the entire problem:
- In some database I have a string value of which I know that it is in encoding with codepage 1250 (for example).
- In another database I have another string value of which I know that it is in encoding with codepage 852.
I need to compare these strings whether they are equal.
Do you have any idea how to do that??
Thanks for any clue!
2/27/2004 8:02:11 PM
There is no such thing in the .NET framework as encoding on the string object. On a byte[], yes, but not on string. This means that your .NET database providers should give you equivalent strings: they should do the transcoding to the universal .net unicode strings and you should have no problem comparing them.

I could tell you how to convert a byte[] from one encoding to another, but it just does not make sense on a .net string.
This posting is provided "AS IS" with no warranties, and confers no rights.
2/28/2004 12:07:19 AM
Thanks for explanation, at least I know it can't be done this way.

BTW: I found out that the strings are originally read from some file and then stored in the database and the problem was that the file had 852 encoding but was read as though it was 1250. Then the strings did not make sense.
Thanks, bye, Hooker
2/28/2004 9:22:46 AM

Similar Artilces:

Converting String from one Encoding Type to Another
Hello  I have this string  Dim MyString as String = "My Text"   I want to convert it to a UTF-8 encoding type or to any other encoding type I specify, how do I do that? use System.Text.Encoding.Convert static method..Dont forget to click "Mark as Answer" on the post that helped you.This credits the member,earns you a point & marks your thread as Resolved so that new users will know where to search for their queries. You are looking at Line numbers 11, 12 and 18, 23 and 25.  Please note this code is taken at

Converting string from one language to another
Hi, I am trying to make an application in which there is a Text Area and we type our text and when we press button labelled "Spanish" it will convert the text to spanish. Are there any articles for this sort of application?HighOnCodingWanna get high! Hi Mohammad, There are many translation services on the net, some of them are free. This is one, this is another, one moreLeon LangleybenMCSD, ASP.NET MVPBlog Thanks but I need links so I can make my own. :D HighOnCodingWanna get high! converting text from a textarea from one langauge to another is a bit more comple...

How to replace string starting with "<!-- Start Here" and ending with "End Here-->" with another string?
I found a site yesterday that showed how to do this, but never saved it. For the life in me I can't seem to find it again. I'm sure its a function of some string class but I can't find it. In a much larger string I need to replace a string starting with "<!-- Start Here" and ending with "End Here-->" with another string? ThanksUsing Visual Studio 2005. Language: C# string s = "<!-- Start Here This is a test End Here-->"; s = s.Replace("<!-- Start Here ", ""); s = s.Replace(" End Here-->", "&qu...

Any function that replaces all occurences of one string in a given string with another third string?
Is there any function that replaces all occurences of one string in a given string with another third string?(Something that works similar to REPLACE() in MS-SQL Server) If not, can anything similar can be worked out somehow using T-SQL? Thanks in advance Replacing single instances can be done with the stuff function. So multiple occurrences can be done with a while loop: declare @CR char (1) select @CR = char (13) -- Carriage Return ... while (exists (select * from #rules where ch...

Another one: UTF-8 encoding with POP/SMTP accounts broken
Hi! Issue: With additional POP3/SMTP accounts and a mime-encoding of UTF-8 the last line of the base64 encoded body gets truncated on the SMTP send. Steps to duplicate: 1. Create an additional account for SMTP sending. 2. Set the mime-encoding (Options/Send) to UTF-8 3. Write a mail from the additional account to yourself 4. Check the message source in 'Sent items' - It does contain a complete base64 encoded message body. 5. Check the received message in your mailbox - The body is missing the last line of the base 64 encoded body. (The receiving SMTP-server does not ...

Get records from one table and insert into another one
I make that but I did not work, thanks  SqlCommand cmd2;cmd = new SqlCommand("SELECT CS_ID FROM Tbl_Conselheiros WHERE CS_TIPO IN (5,6,7)", conn); dr = cmd.ExecuteReader();  while (dr.Read()) {cmd2 = new SqlCommand("SP_PRES_GRAVAR", conn); cmd2.CommandType = CommandType.StoredProcedure;SqlParameter id = new SqlParameter("@ID_CONSE", SqlDbType.Int, 4);id.Value = Convert.ToInt32(dr[0]); cmd2.Parameters.Add(id);SqlParameter data2 = new SqlParameter("@DATA", SqlDbType.VarChar, 8); data2.Value = FormataData(); cmd2.Parameters.Add(data...

.Net Application generators
There are a few .Net complete n-tier application generators that generate directly from your database. Some even have their own database building tools. They are great and easy to follow and their applications generate real VB.Net and C# code, easy to learn. These are great starts for .Net stuff except for one thing, PRICE. Iron Speed is about $1500 and for the same exact product features ASPNetNow sells for only $279 for their Web Matrix version or $530 for VS version. Another company Avalanche sells for $995. Amazing price ranges. The first two match feature for feature except the first yo...

To Encode String or to Not Encode String... Answer?
I am importing a CSV file from a Unix server as a string, and then saving the string into a new file for later processing.  However, this process does not always work.  As this CSV file is VERY, VERY large, I am unable to immediately tell if the fault lies with my code, or the CSV file provider (very possible).  The only time I can tell that this happened is when the data is not populated the next morning.  The fault appears to lie in there being extra or missing commas, as when I try to run the data import manually, STRINGs are attempted to be inserted into INT...

Convert INT value to STRING so I can add it to another STRING
I'm trying to figure out how to convert an INT so that I can add it to another string in a statement likeSELECT '<a href="' + [IntValue] + '">' + [LinkName]Where [IntValue] is an INT field containing a folder number.  I tried: TO_CHAR([IntValue, '999')but it didn't work. And I tried to find a TO_STRING function, but had no luck.Any advice to someone who is savy, but new to SQL Queries? SELECT '<a href="' + STR([IntValue]) + '">' + [LinkName]HTHregardsASP.NET Hosting (HostingFest) Bingo!  I had to restrict the fu...

Getting error while converting string to double: Input string was not in correct format
Select Case LocalMeasuringUnitText Case "Currency" 'do the conversion hereDim ConversionRate As Double = GetConversionRate(_LanguageID)   Dim UKValue As Double 'String.Format("{0:c}", SelectedRow(rowloop).Item("TransData").ToString()) Dim varValue As Object = NothingDim Stringvalue As Object = SelectedRow(rowloop).Item("TransData").ToString.Trim 'varValue = Double.TryParse(Stringvalue, varValue) 'CType(Stringvalue, System.Double) 'UKValue = Convert.ToDouble(Stringvalue) / GetConversionRate(ConfigurationManager.AppS...

convert byte[] to String and string to byte[] note encoding and decoding required....
hi all,        As the subject, can I have solution ofr the same.......  e'i Convert byte[] into string and strting into byte[] , can i have teh sample page.        Thanks & Regards,Murthy.          System.Text.Encoding.Unicode.GetString(ByteArray);//Byte Array to String             System.Text.Encoding.Unicode.GetBytes(String);//String to Byte ArrayWe All move to our original place.Don't forget.Imran Baloch thanks for...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

used a to converter and am now getting a syntax error.
ok I used a cool utility at to convert some to and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

Converting classic to .NET 2 code, and .NET gets an error back from ADS?
 For future-proofing, our Internal Phone Directory is being moved onto our AD servers, and obviously we're using LDAP for queries.To get the phoneboook queries working, I adapted the current classic ASP code to use LDAP, and that works fine. However, we're wanting to move these pages to .NET, and that's where the problem comes in. Using the same basic logic from the Classic code (90% of its unchanged) to produce an LDAP query, I get the error  155 Unknown error (0x80005000)This is using the same website, and so the same credentials  - unless aspx pages run und...

Web resources about - How to convert a string from one encoding to another -

Encoding (memory) - Wikipedia, the free encyclopedia
Visual, acoustic, and semantic encodings are the most intensively used. Other encodings are also used. Acoustic encoding is the encoding of auditory ...

Twitter image encoding challenge
If a picture's worth 1000 words, how much of a picture can you fit in 140 characters? Note : That's it folks! Bounty deadline is here, and after ...

【medical-news】Genetic Variation in NR1H4 Encoding the Bile Acid Receptor FXR - 医药生命科学动态跟踪 -丁香园论坛
Context: Bile acid signaling via farnesoid X receptor (FXR) regulates glucose and lipid levels, fat mass, and hepatic steatosis in animal models.Objective: ...

HandBrake Open Source video transcoder v0.10 released with hundreds of new features including H.265 and ...
... can be used for transcribing many different types of files/codecs to almost any other. Today’s headliner updates include H.265 and VP8 encoding. ...

CJK Type - CJK Fonts, Character Sets & Encodings. All CJK. All of the time.
As I wrote nearly a year ago , the Adobe-Identity-0 ROS is useful for building special-purpose fonts, especially CJK ones whose glyph coverage ...

Link Encoding Goes Mobile With Deep Links From Bitly
... Facebook and Google have been competing to bring the best solution for tracking deeplinks . This week, Bitly announced its own linking encoding ...

Encoding Articles - AppAdvice iPhone/iPad News
Latest Encoding Articles - AppAdvice iPhone/iPad News

AirMovie - Enjoy the videos in your PC anytime, anywhere with NO ENCODING!!
Holen Sie sich „AirMovie - Enjoy the videos in your PC anytime, anywhere with NO ENCODING!!“ im App Store. Sehen Sie sich Screenshots, Bewertungen ...

More tips on encoding video for Apple TV and iPod, from us to you
Apple tells video podcasters how to encode their content, which is also useful …

Handbrake 0.9.6 gives some, takes some encoding features
The Handbrake Project has announced an update to its open-source, cross-platform video transcoding utility. Handbrake 0.9.6 includes new and ...

Resources last updated: 12/7/2015 5:56:33 PM