473,406 Members | 2,954 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.

decoding =E5, =F8

Hi

in the processing of some text files, I have found I have strings like:

f=E5t
pr=F8ve

where the strings "=E5" and "=F8" are danish characters "å" and "ø". I can
work this out myself, but how can my program know - or at least what
"decoding" do I need to do to get the correct characters in my string?

Thanks,
Peter

Jun 15 '07 #1
6 3213
Peter K <xd****@hotmail.comwrote:
in the processing of some text files, I have found I have strings like:

f=E5t
pr=F8ve

where the strings "=E5" and "=F8" are danish characters "å" and "ø". I can
work this out myself, but how can my program know - or at least what
"decoding" do I need to do to get the correct characters in my string?
It's not entirely clear what you mean. Does the text file contain
"=E5" but it *should* contain a Danish character, or were you doing
some replacement for us?

What's the source of the text file?

--
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
Jun 15 '07 #2
Jon Skeet [C# MVP] <sk***@pobox.comwrote in
news:MP*********************@msnews.microsoft.com:
Peter K <xd****@hotmail.comwrote:
>in the processing of some text files, I have found I have strings
like:
>>
f=E5t
pr=F8ve

where the strings "=E5" and "=F8" are danish characters "å" and "
ø". I can
>work this out myself, but how can my program know - or at least what
"decoding" do I need to do to get the correct characters in my string?

It's not entirely clear what you mean. Does the text file contain
"=E5" but it *should* contain a Danish character, or were you doing
some replacement for us?

What's the source of the text file?
The text files are actually xml (if that makes a difference).

And in actual fact the xml nodes I am interested in contain a "base64
encoded" string. So I extract this string, which is a long piece of text
starting:
"DQo8YnI+PGZvbnQgc2l6ZT0xIGNvbG9yPXdoaXRlIGZhY2U9I lZlcmRhbmEL".

I un-encode this base64 string, and get another text string which is in
"html" format. (With all sorts of html tags in it).

Some of this html contains the 3 symbols
= E 5
for example. (No spaces between the symbols).

They represent obviously the Danish letter 'å' (obviously because a
danish speaker can see it from the word it appears in).

So for example, the text file may contain strings like:

"f=E5et"

(I don't know how you see this string in your news reader - but I see it
as 6 characters: f = E 5 e t).
As a part of processing, my program needs to convert these strings (=E5)
to real text (å).

But I don't know what this encoding is, or how to decode it.

Thanks,
Peter
Jun 15 '07 #3
Looks like encoding for SMTP, is it a string from an email?
You can see how this encoding is done here:
http://www.lesnikowski.com/mail/Rfc/rfc2047.txt
I don't know if there is a freeware component that can decode this kind of
thing.

Kind Regards,
Allan Ebdrup
Jun 15 '07 #4
* Allan Ebdrup wrote, On 15-6-2007 16:01:
Looks like encoding for SMTP, is it a string from an email?
You can see how this encoding is done here:
http://www.lesnikowski.com/mail/Rfc/rfc2047.txt
I don't know if there is a freeware component that can decode this kind of
thing.

Kind Regards,
Allan Ebdrup

Indeed it looks like quoted printable encoding of text messages sent
through mail or otherwise. Maybe the System.Net.Mail namespace can help
you out here. But I'd have to dig just as far as you would.

Jesse
Jun 15 '07 #5
Jesse Houwing <je***********@nospam-sogeti.nlwrote in
news:#t**************@TK2MSFTNGP02.phx.gbl:
* Allan Ebdrup wrote, On 15-6-2007 16:01:
>Looks like encoding for SMTP, is it a string from an email?
You can see how this encoding is done here:
http://www.lesnikowski.com/mail/Rfc/rfc2047.txt
I don't know if there is a freeware component that can decode this
kind of thing.

Kind Regards,
Allan Ebdrup

Indeed it looks like quoted printable encoding of text messages sent
through mail or otherwise. Maybe the System.Net.Mail namespace can
help you out here. But I'd have to dig just as far as you would.
Ah - this could be right, because some of the other texts I get are not
encoded at all and come with all sorts of "multipart" metadata like
content-type and content-transfer-encoding. And some of them say "quoted-
printable".

The base64-encoded html I am currently having trouble with has no such
encoding information however.

The xml files I am processing are not containing emails as far as I know,
but all sorts of data which has been extracted from a "Domino-Notes"
database and transformed to xml. Horrible xml if you ask me.

Thanks for the help/pointers.
Peter
Jun 15 '07 #6
Peter K wrote:
Jesse Houwing <je***********@nospam-sogeti.nlwrote in
news:#t**************@TK2MSFTNGP02.phx.gbl:
>* Allan Ebdrup wrote, On 15-6-2007 16:01:
>>Looks like encoding for SMTP, is it a string from an email?
You can see how this encoding is done here:
http://www.lesnikowski.com/mail/Rfc/rfc2047.txt
I don't know if there is a freeware component that can decode this
kind of thing.
Indeed it looks like quoted printable encoding of text messages sent
through mail or otherwise. Maybe the System.Net.Mail namespace can
help you out here. But I'd have to dig just as far as you would.

Ah - this could be right, because some of the other texts I get are not
encoded at all and come with all sorts of "multipart" metadata like
content-type and content-transfer-encoding. And some of them say "quoted-
printable".

The base64-encoded html I am currently having trouble with has no such
encoding information however.

The xml files I am processing are not containing emails as far as I know,
but all sorts of data which has been extracted from a "Domino-Notes"
database and transformed to xml. Horrible xml if you ask me.
A hack and a real Quoted Printable decode (note that real quoted
printable sometimes skips newlines as well - you will need to add that
if needed):

public static string FromQP1(string s)
{
return s.Replace("=E6", "æ").Replace("=F8", "ø").Replace("=E5",
"å").Replace("=C6", "Æ").Replace("=D8", "Ø").Replace("=C5", "Å");
}
public static string FromQP2(string s)
{
StringBuilder sb = new StringBuilder("");
int ix = 0;
while(ix < s.Length)
{
if(s[ix] == '=')
{
sb.Append((char)int.Parse(s.Substring(ix + 1, 2),
NumberStyles.HexNumber));
ix += 3;
}
else
{
sb.Append(s[ix]);
ix++;
}
}
return sb.ToString();
}
Arne
Jun 16 '07 #7

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

Similar topics

3
by: steve | last post by:
Hi, I am opening a stream that is UTF encoded. I use fgetc to read the stream- which is binary safe. I add every character read to a string. But when I look at the stream, I see some...
1
by: Thomas Williams | last post by:
Hello everyone, my name is Tom W. And, I am new to the list, and have been using Python for about a year now. Anyway, I got a question! I am trying to decode MIME (base64) email from a POP3...
40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
5
by: Peter Jansson | last post by:
Hello group, The following code is an attempt to perform URL-decoding of URL-encoded string. Note that std::istringstream is used within the switch, within the loop. Three main issues have been...
14
by: BB | last post by:
Hello. i am trying to decode a block of (what i think is) base64 into text, and i have NO idea how to begin. I'm going to paste the whole string here, but i want to know the steps necessary to...
25
by: marcin.rzeznicki | last post by:
Hello everyone I've got a little problem with choosing the best decoding strategy for some nasty problem. I have to deal with very large files wich contain text encoded with various encodings....
9
by: KWSW | last post by:
Having settled the huffman encoding/decoding and channel modeling(thanks to the previous part on bitwise operation), the last part would be hamming encoding/decoding. Did some research as usual on...
0
by: Michele | last post by:
Hi there, I'm using a python script in conjunction with a JPype, to run java classes. So, here's the code: from jpype import * import os import random import math import sys
42
by: Santander | last post by:
how to decode HTML pages encoded like this: http://www.long2consulting.com/seeinaction2008/Simplicity_Beach_table/index.htm Is there script that will do this automatically and generate normal fully...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.