Jump to content
Chinese-Forums
  • Sign Up

Convert =?GB2312?B? string


sthubbar

Recommended Posts

Can any of the more technical people help me find a program to convert

=?GB2312?B?v827p2RtZjE5ODcwNDEw?=

into Chinese characters?

I received an export of my email contact and it looks like all the non-American characters got turned into these special type of strings.

Thanks.

Link to comment
Share on other sites

888 and Rody,

Thanks. This tool does work one I implemented Rody's suggesting of changing the browser encoding to GB2312.

Now, is there any way to do this for many entries? I have over 100 of such entries and some of them aren't GB2312, they are French, or other foreign language encoding.

I saw Imron mention iconv in another posting. I have update cygwin and now have iconv on my PC, though aren't sure how to get it to work, or if it will even work.

Thanks.

Roddy, I'm continually impressed at how well run and useful this forum is. Great job.

Link to comment
Share on other sites

I found this site which seems like almost the answer: http://stackoverflow.com/questions/271657/how-to-tell-if-a-string-is-base64-or-not

=?gb2312?B?uLGxvmhlbrixsb5nLnhscw==?=

"=?" introduces an encoded value

"gb2312" denotes the character encoding of the original value

"B" denotes that B-encoding (equal to Base64) was used (the alternative

is "Q", which refers to something close to quoted-printable)

"?" functions as a separator

"uLG..." is the actual value, encoded using the encoding specified before

"?=" ends the encoded value

Though when I try to use iconv to convert from base64 to gb2312 I get

>iconv -f base64 -t GB2312

iconv: conversion from base64 unsupported

iconv: try 'iconv -l' to get the list of supported encodings

Is there some other name for base64?

Link to comment
Share on other sites

I have made some progress.

It appears that the text between =?GB2312?B? and the final ?= is just base64 encoded and if I use base64 it decodes them just fine.

I put a list of these in text.txt and then ran.

>for /f %i in (text.txt) do \cygwin\bin\echo.exe -e %i | \cygwin\bin\base64 -d >> output.txt && echo. >>output.txt

It worked great and the output is Chinese characters that appear to be correct.

Now the thing I don't understand is if it is just base64, why doesn't it work with the other encodings for example:

=?BIG5?B?q7ggq7iu567n?=

=?ISO-2022-JP?B?WmhvdU11TGl1GyRCPH5MWkx4GyhC?=

=?ISO-8859-1?Q?Ang=E9lique_Poirier?=

=?KOI8-R?B?7NHOIOnSyc7X?=

When I try the same technique on these, it doesn't seem to work so smoothly.

I'll keep playing around and maybe someone will really understand what is going on and can help.

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and select your username and password later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Click here to reply. Select text to quote.

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...