<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fax &#8211; Arun&#8217;s blog</title>
	<atom:link href="https://arunns.net/category/communication/fax/feed/" rel="self" type="application/rss+xml" />
	<link>https://arunns.net</link>
	<description>Arun&#039;s blog</description>
	<lastBuildDate>Sun, 22 Oct 2023 04:35:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.2</generator>
	<item>
		<title>Hylafax/FaxMail with unicode encoding</title>
		<link>https://arunns.net/hylafax-with-unicode-encoding/</link>
					<comments>https://arunns.net/hylafax-with-unicode-encoding/#respond</comments>
		
		<dc:creator><![CDATA[Arun N.]]></dc:creator>
		<pubDate>Sun, 25 Oct 2009 12:26:36 +0000</pubDate>
				<category><![CDATA[Fax]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://arunnsblog.com/blog/?p=52</guid>

					<description><![CDATA[Dealing with Unicode encoding can be a challenging task. However, it&#8217;s crucial for ensuring the accurate transmission of messages. In this blog post, we&#8217;ll explore some scripts and techniques that can help you work with Unicode in Hylafax/FaxMail, specifically for incoming HTML and text faxes. HTML Fax Handling: When it comes to processing HTML faxes [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Dealing with Unicode encoding can be a challenging task. However, it&#8217;s crucial for ensuring the accurate transmission of messages. In this blog post, we&#8217;ll explore some scripts and techniques that can help you work with Unicode in Hylafax/FaxMail, specifically for incoming HTML and text faxes.</p>
<p><strong>HTML Fax Handling:</strong></p>
<p>When it comes to processing HTML faxes with Unicode encoding, you can use the following script</p>
<div class="bg-black rounded-md mb-4">
<pre class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash"><span class="hljs-meta">#!/bin/bash</span><br /></code><code class="!whitespace-pre hljs language-bash"><span class="hljs-built_in">cp</span> -pf <span class="hljs-variable">$1</span> /tmp/email.html<br /></code><code class="!whitespace-pre hljs language-bash">/usr/bin/lynx -dump -display_charset=utf-8 /tmp/email.html &gt; /tmp/html_txt<br /></code><code class="!whitespace-pre hljs language-bash">/usr/bin/uniprint -font /etc/hylafax/faxmail/Cyberbit.ttf -<span class="hljs-keyword">in</span> /tmp/html_txt -out /tmp/html_txt.uni<br /></code><code class="!whitespace-pre hljs language-bash"><span class="hljs-built_in">cat</span> /tmp/html_txt.uni | /etc/hylafax/faxmail/filter.pl<br /><span class="hljs-built_in">rm</span> /tmp/email.html<br /></code><code class="!whitespace-pre hljs language-bash"><span class="hljs-built_in">rm</span> /tmp/html_txt<br />r<span class="hljs-built_in">m</span> /tmp/html_txt.uni<br />
</code></pre>
</div>
<p>Here&#8217;s a breakdown of what this script does:</p>
<ul>
<li>It copies the incoming fax to a temporary file, <code>/tmp/email.html</code>.</li>
<li>Using <code>lynx</code>, redirect the HTML content to plain text while specifying the UTF-8 character set for proper encoding.</li>
<li>The <code>uniprint</code> utility is then used to apply the <code>Cyberbit.ttf</code> font to the converted text, saving it as <code>/tmp/html_txt.uni</code>.</li>
<li>Finally, it pipes the content through <code>filter.pl</code>, a Perl script that processes the text.</li>
</ul>
<p><strong>Plain Text Fax Handling:</strong></p>
<p>For plain text faxes with Unicode encoding, you can utilize this script</p>
<div class="bg-black rounded-md mb-4">
<div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash"><span class="hljs-meta">#!/bin/sh</span><br />
</code><code class="!whitespace-pre hljs language-bash">/usr/bin/uniprint -font /etc/hylafax/faxmail/Cyberbit.ttf -<span class="hljs-keyword">in</span> <span class="hljs-variable">$1</span> -out /tmp/plain_txt<br />
</code><code class="!whitespace-pre hljs language-bash"><span class="hljs-built_in">cat</span> /tmp/plain_txt | /etc/hylafax/faxmail/filter.pl<br />
<span class="hljs-built_in">rm</span> /tmp/plain_txt<br />
</code></div>
</div>
<p>This script is more straightforward. It uses <code>uniprint</code> to apply the <code>Cyberbit.ttf</code> font to the plain text content, and then pipes it through <code>filter.pl</code>.</p>
<p><strong>filter.pl:</strong></p>
<p>The <code>filter.pl</code> Perl script is responsible for processing the text content, including stripping out any &#8220;showpage&#8221; directives.</p>
<div class="bg-black rounded-md mb-4">
<div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-comment">#!/usr/bin/perl</span><br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-comment"># Read from the standard input</span><br />
</code><code class="!whitespace-pre hljs language-perl">@text=;<br />
</code><code class="!whitespace-pre hljs language-perl">$size=@text;<br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-comment"># Count the number of "showpage"</span><br />
</code><code class="!whitespace-pre hljs language-perl">$count=<span class="hljs-number">0</span>;<br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">for</span>($i=<span class="hljs-number">0</span>;$i&lt;=$size;$i++){<span class="hljs-keyword">if</span>($text[$i] =~ <span class="hljs-regexp">/showpage/</span>){$count++;}}<br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-comment"># Discard the last line that contains "showpage"</span><br />
</code><code class="!whitespace-pre hljs language-perl">$num=<span class="hljs-number">1</span>;<br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">for</span>($i=<span class="hljs-number">0</span>;$i&lt;=$size;$i++){<br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">if</span>($text[$i] =~ <span class="hljs-regexp">/showpage/</span>)</code><code class="!whitespace-pre hljs language-perl">{</code></div>
<div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">if</span>($num!=$count){$num++;}<br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">else</span>{$text[$i]=~<span class="hljs-regexp">s/showpage//g</span>;}<br />
</code><code class="!whitespace-pre hljs language-perl">}<br />
</code><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">print</span> $text[$i];<br />
</code><code class="!whitespace-pre hljs language-perl">}<br />
</code></div>
</div>
<p>This Perl script processes the text, counts the &#8220;showpage&#8221; occurrences, and removes the last &#8220;showpage&#8221; directive.</p>


<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://arunns.net/hylafax-with-unicode-encoding/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
