⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base64.htm

📁 applet在線上繪圖,允許在瀏覽器上繪圖,最後儲存成各式的圖檔
💻 HTM
字号:
<html>
<head>
   <meta&nbsp;http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title>BASE64 encoding</title>
<link REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</head>
<body>
<a href="./index.htm">CONTENTS</a>

<h3>BASE64 encoding</h3>

<p>
BASE64 encoding performs any binary data&nbsp;as text (using only printable characters).
Such text representation allows to pass binary data&nbsp;via&nbsp;a&nbsp;channel or save to a&nbsp;storage
intended for text only, for example: e-mail software uses BASE64 encoding to hold attached files.
</p>
<p>
J-Painter uses BASE64 encoding to <a href="saving.htm#javascript">return image data&nbsp;to JavaScript</a>,
post them to the&nbsp;server using <a href="saving.htm#post">standrad post request</a>, or accept an image
file via&nbsp;the <a href="placing.htm#DrawCanvas">canvas</a> parameter "image".</p>

<p>Encoding example:</p>

<p>This image <img src="mail.png" > is retrieved from a&nbsp;binary file.
BASE64 encoded version of this file looks as follows:</p>

<pre>iVBORw0KGgoAAAANSUhEUgAAACAAAAATBAMAAAADuhLEAAAABGdBTUEAALGP
C/xhBQAAAAFzUkdCAdnJLH8AAAAPUExURYSEhP///wAAAP//AP8AACykMFsA
AABsSURBVHjahdDBDcMwDENRWhsw9AJRuwCBLuAi+8+UQ+rGTg75NwkPECBg
LlDmAuBUoCyZfapbm4Tr1gJlybVvPt/XKMz6boHyX4iWBmGKdBf5i6cwSVpX
4fGKnoRpqQsdV+1TmLYkBW4Pyks7gc8WIpISYokAAAAASUVORK5CYII=</pre>

<p>You can find the&nbsp;encoding technique here: <a href="http://www.ietf.org/rfc/rfc1521.txt" target="blank">http://www.ietf.org/rfc/rfc1521.txt</a>,
but most likely you needn't know them because many server-side scripting languages support functions for BASE64 encoding/decoding.
</p>

<ul><li>Did you know that you can use BASE64 to keep images in text fields of a&nbsp;database,<br>
        and even save them in the&nbsp;database using SQL statements ?</li></ul>

<h4>How to decode BASE64 encoded data&nbsp;in different scripting languages.</h4>

<p><b>PHP</b></p>
<p>PHP has built in functions for BASE64 encoding and decoding:</p>

<pre>
base64_decode();
base64_encode();
</pre>

<hr>
<p><b>ASP.NET</b></p>
Use the function:
<pre>
System.Convert.FromBase64String(baseString);
</pre>

<hr>
<p><b>ASP</b></p>

<p>ASP has not built in functions for BASE64 decoding, but
you can find a&nbsp;nice implementation in VBScript here
<a href="http://www.pstruh.cz/tips/detpg_Base64.htm" target="_blank">http://www.pstruh.cz/tips/detpg_Base64.htm</a>
</p>

<hr>
<p><b>Java</b></p>

<p>There are a&nbsp;lot of BASE64 encoding/decoding implementations in Java.
For example, you may use my own implementation <a href="Base64.java" target="_blank" ><code>Base64.java</code></a>.
This file is located in the&nbsp;JSP example directory.
</p>

<hr>
<p><b>Perl</b></p>
<p>For BASE64 decoding use the&nbsp;function</p>

<pre>MIME::Base64::decode($encoded)</pre>

<hr>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -