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 6 3231
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.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP] <sk***@pobox.co mwrote in
news:MP******** *************@m snews.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+PGZvbn Qgc2l6ZT0xIGNvb G9yPXdoaXRlIGZh Y2U9IlZlcmRhbmE L".
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
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
* 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
Jesse Houwing <je***********@ nospam-sogeti.nlwrote in
news:#t******** ******@TK2MSFTN GP02.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
Peter K wrote:
Jesse Houwing <je***********@ nospam-sogeti.nlwrote in
news:#t******** ******@TK2MSFTN GP02.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.Su bstring(ix + 1, 2),
NumberStyles.He xNumber));
ix += 3;
}
else
{
sb.Append(s[ix]);
ix++;
}
}
return sb.ToString();
}
Arne This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 characters with a bunch of
"?" question markets, and then utf8_decode has no effect on it
either.
How do you go about decoding utf. Does adding the characters to the
|
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 server, but all I get is a
corrupt file. I know that it good to begin with
because I check it with another email client.
This is what I am doing!
|
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.
However when you retrieve these values into a dataset and ToString() them
|
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 idea that
costs nothing and it is inheritently built into the Framework. So here
is the solution...
When you use the WebRequest and WebResponse classes to obtain graphics
from a web site, these classes have built-in decoding for JPEG 2000
files....
|
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 raised about the code;
1. If characters after '%' do not represent hexademical number, then
uninitialized value variable 'hexint' used - this is undefined behavior.
2. This code is very inefficient - to many mallocs/string
| |
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 convert it to text.
i've tried the usual binary/ascii techniques, but they just seem to
loop back in to each other. what is the step by step to get from
base64 to text? this is for an evil riddle i'm trying to solve.
thanks. Becca. here's the...
|
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. Their length makes loading
contents of file into memory in single run inappropriate. I solved this
problem by implementing memory mapping using P/Invoke and I load
contents of file in chunks. Since files' contents are in different
encodings what I...
|
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 hamming codes and how they work(well sort of) I got a general idea how to start constucting a (7,4) hamming code.
Unfortunately I have no idea how to start on the decoding/error correcting part and some direction would be nice.
---
for...
|
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
|
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
readable HTML?
Santander
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |