charset/base64 encoding/encode.

Still futzing around with email and character sets.

Under Encode and perluniintro there's mention of
octet          \x{..} (255 chars up to \xff
string         some internal representation
code point     \x{...} 1, 2 or more bytes of data

But I'm not sure about the order of things.

So I'll try this:

I have a MIME messsage part like the following:

Content-Type: text/plain;
	charset="BIG5"
Content-Transfer-Encoding: base64

1eLKx9K7t+JIVE1MuPHKvdDFvP6joQ0KCqFYoVihWKFYoVihWKFYoVihWKFYoVihWKFYoVihWKFY
oVihWKFYoVihWKFYoVihWKFYoVihWKFYoVihWAqhaapgt06haqRXrbGquoVvpfOBWK5lyU+lSKRV
pOWmcsbTi9ehQ6W7hLCl84Wyra2kX6ZYqmulzrN+IQqGR4VvpfOl0aFtVm9sbGV5bWFpbIVvpfO4
c4T6g/2uYaFuhLCl84T6sGWhRrNRykmkzYVUg2+zzIetrmAKqrqFb6XzuHOE+oSwpfOm06Zoprit
bqhEr3240aFJhGOnS4VkpFWGXqFBxtOtrYO6hX2oz6XOoUMKhkixoYhbhKGD9Kfag6iquqVEg6Sh
R2h0dHA6Ly93d3cuY255c29mdC5jb20v

MIME::Base64 has a function
my $decoded = decode_base64($DATA);
that returns really wonderful crud to my screen.  But I can't regex it.

I think it returns octects.  At least that what MIME::Base64 says.
So I should be able to do

my $base64 = join('',<DATA>);
my $octets = decode_base64($base64);
my $utf8 = decode('Big5',$octets);

and from there I can use something like /(\w+)/ on it.
(But IIRC /[\w]+/ will act weird).

printing it out require 'binmode(...)' but I can do stuff internally to the program.

Which is all good.  And I guess it's progress.
But can I expect to ALWAYS find a charset declaration on the Content-Type line 
if it isn't just ascii?  (There is sometimes a content-type in the header which 
I assume applies to all)
0
tom
6/19/2007 10:00:53 AM
perl.beginners 29388 articles. 4 followers. Follow

0 Replies
1347 Views

Similar Articles

[PageSpeed] 29

Reply:

Similar Artilces:

[Encode] Encoding vs. Charset
Encode hackers (Especially Autrijius) I am now fairly content with the feature set of Encode so I decided to write some programs based upon it. And I have found that most of Chinese (Continental; seems like Taiwanese are much more technically correct) and Korean mails and web pages confuse "charset" and "encodings". That is, charset="gb2312" really means euc-cn and charset="ks_c_5601-1987" really menas euc-kr. Sadly this misconception is enbedded to popular browsers. So when you try something like my ($encname) = /^Content...

doubled Encode.pm: ext\Encode\Encode.pm and lib\Encode.pm
Hello, developers! Currently @15439 I see some surprising situation: Encode.pm has doubled: ext\Encode\Encode.pm lib\Encode.pm moreover, its documentation friends have also doubled: ext\Encode\lib\EncodeFormat.pod ext\Encode\lib\Encode\Details.pod ext\Encode\lib\Encode\Supported.pod ext\Encode\lib\Encode\Encoding.pm lib\EncodeFormat.pod lib\encode\Details.pod lib\encode\Supported.pd lib\encode\Encoding.pm and so have the .enc files: ext\Encode\Encode lib\Encode So I see the following locations have surprising content: lib\Encode ext\Encode ext\Encode\E...

Encoding into ASCII text using base64 encoding
how can i use asp.net to encoding a fle into ASCII text using base64 encoding. byte[] buffer = System.Text.ASCIIEncoding.ASCII.GetBytes( "Your string here" );string stuff = System.Convert.ToBase64String( buffer ); Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!...

[PATCH] Encode::Encoding
package Encode::MyEncoding; use base qw(Encode::Encoding); __PACKAGE__->Define(qw(myCanonical myAlias)); dies saying: Error: Undefined subroutine &Encode::define_encoding called at ... Patch follows after sig. -- Tatsuhiko Miyagawa <miyagawa@edge.co.jp> --- lib/Encode/Encoding.pm~ Sun Apr 28 05:09:05 2002 +++ lib/Encode/Encoding.pm Mon May 6 18:48:59 2002 @@ -3,6 +3,8 @@ use strict; our $VERSION = do { my @r = (q$Revision: 1.29 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +require Encode; + sub Define { ...

Encode vs encoding
Hi to all list users. Can someone *please* explain me the difference between (except the scope) encoding and Encode::encode()? I know encoding affects all the code, but what else does it do to do the right thing or am I missing something with Encode? I'm using ActivePerl 5.8.4 build 810 under Windows 2000 and here are the examples: #!/usr/bin/perl -w use strict; my $char = "\xFE"; print ord $char; # prints 254 #!/usr/bin/perl -w use strict; use Encode; my $char = "\xFE"; $char = encode 'ISO-8859-9', $char; print ord $char; # prints 6...

Charset encoding
Win7HPx64. TB13.0.1 In Tools | Options | Display | Formatting | Fonts | Advanced | Character encodings I have the default encoding for both Incoming and Outgoing Mail set to Western (ISO-8859-1), and, where possible, to use the default encoding in replies. Why, then, replying to a newsgroup posting in UTF-8, did my post also appear in UTF-8? Or is the option noted above really only for mail and not newsgroup postings? -- Jeff On 20/06/2012 4:16 PM, Jeff Layman wrote: > Win7HPx64. TB13.0.1 > > In Tools | Options | Display | Formatting | Fonts | Advanced ...

Html.Encode encodes too much
Hi, When I output some french characters like é è ç à with Hml.Encode, they are escaped as &#233; &#232; &#231; &#224 in the generated HTML. I fear to see almost everything escaped if I translate my application into korean or russian. If I am not wrong, only < > & and " should be escaped. All the other characters are handled directly by the HTTP response encoding (iso-8859-1 for my french characters) and thus should be kept as is in the generated HTML.   Is there a way to override the default Html.Encode by another one ?   It's p...

Base64 Encoding
Is there a way in powerbuilder to encode in Base64? if not, anyone knows a web site where I could find DLLs to do so? Thanks! Stephen It can be done (I've tried it) but the performance was pathetic.... The CSMTPConnection class that I use in my PBNI SMTP component implements Base64 encoding. You might write your own DLL based on that: http://www.naughter.com/smtp.html On 28 Jan 2004 05:14:28 -0800, "SMarcoux" <smarcoux@cbgi.qc.ca> wrote: >Is there a way in powerbuilder to encode in Base64? > >if not, anyone knows a web site where I cou...

Encode Base64
I want to encode my image to base64 but EncdDecd.EncodeBase64 gives me string with #13#10. Is this normal? I think those characters should not be used in base64. ms1 := TMemoryStream.Create; try Self.Bitmap.SaveToStream(ms1); ms1.Position := 0; s := EncdDecd.EncodeBase64(ms1.Memory, ms1.Size); finally sl.Free; ms1.Free; end; grega wrote: > I want to encode my image to base64 but EncdDecd.EncodeBase64 gives me > string with #13#10. Is this normal? I think those characters should > not be used in base64. Yes, it is norma...

Encode::encode MIME-Header
The routine should not gobble up white space. This leads to all manner of bad side-effects, such as encoded words starting and ending with spaces where you'd want words surrounded by spaces, or encoding sequences of words instead of single words. Fix: When constructing $especials, change the first line to read join( '|' => '\s', map { quotemeta( chr($_) ) } ---------------^^^^^ ...

[Encode] Encode::Supported revised
Folks, Encode is near completion. I am still bulding djgpp environment for possible fixes needed but anything else is over. Meanwhile, Please have a look at Encode::Supported revised for added Encodings (now Encode comes with all encodings covered by http://www.unicode.org/Public/MAPPINGS/ -- except for Indics which are beyond cap. of the current encengine; Algorithmical approaches still possible. Porters wanted. See below). Enjoy. Dan the Encode Maintainer =head1 NAME Encode::Supported -- Supported encodings by Encode =head1 DESCRIPTION =head2 Encodin...

Base64 encoding
Hi,I have created a generic handler that outputs resized images. I want to add a querystring parameter with the path to the file ("c:\\images\\image1.jpg").It is not safe to just add the path to the file so i think it is best to do a base64 encoding. How can i do that in C# 2.0? Or is there a better way to encode this?ThanksKoen...

Base64 encoding
Hi all! My question is as follow: How can I convert binary data (blob) into a string encoding Base64 and viceversa? I need it without using the Windows API functions CryptBinaryToString and CryptStringToBinary wich fails in W2000 (only works OK in XP and W2003). Is there any algorithm implemented in PowerBuilder that performs these features? I know that in VisualBasic they exists. Thank you in avance for your help Regards Fran I hve just find out the response in PFC forum: Search for a PBNI PowerPack on CodeXchange https://powerbuilder.codexchange.sybase.com/servle...

[PATCH 5.7.3 Encode] encoding.t not properly skipped when Encode extension not built
--- lib/encoding.t 2002/03/28 09:20:19 1.1 +++ lib/encoding.t 2002/03/28 09:20:34 @@ -1,4 +1,9 @@ BEGIN { + require Config; import Config; + if ($Config{'extensions'} !~ /\bEncode\b/) { + print "1..0 # Skip: Encode was not built\n"; + exit 0; + } if (ord("A") == 193) { print "1..0 # encoding pragma does not support EBCDIC platforms\n"; exit(0); Same problem here in lib/open.t, but this one isn't so easy to fix. Someone with more understanding should look at it. ...

Web resources about - charset/base64 encoding/encode. - perl.beginners

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: 1/11/2016 5:35:48 PM