<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font size=2 color=navy face=Arial>
To ensure you preserve characters, you need to go via the proper utf8 encoder when going from characters to bytes and vice versa.<br> <br>-Boris (via BlackBerry)</font></div>
<br><div><hr size=2 width="100%" align=center tabindex=-1>
<font face=Tahoma size=2>
<b>From</b>: seaside-bounces@lists.squeakfoundation.org &lt;seaside-bounces@lists.squeakfoundation.org&gt; <br><b>To</b>: Seaside - general discussion &lt;seaside@lists.squeakfoundation.org&gt; <br><b>Sent</b>: Tue Sep 28 10:16:26 2010<br><b>Subject</b>: Re: [Seaside] Downloads and filenames with diacritics <br></font><br></div>
Yeah, that is sexy.<div><br></div><div>It also needs it's complement:</div><div><br></div><div>String class&gt;&gt;fromHex: anHexString</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"It returns the string that has its characters encoded in hex.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>'el ñandú' asHex&nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>String fromHex: '656C20F1616E64FA'.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>Play with those."</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^ String streamContents: [:stream| |source|</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>source := anHexString readStream.</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[source atEnd] whileFalse: [</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>stream nextPut: (Character value: (Integer readFrom: (source next: 2) radix: 16))]].</div><div><br></div><div>&nbsp;sebastian</div><div><br></div><div><br></div><div><br><div><div>On Sep 28, 2010, at 1:50 PM, Boris Popov, DeepCove Labs wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div>
<!-- Converted from text/plain format --><p><font size="2">Have you tried hexing the bytes and using that as a filename?<br>
<br>
(aString asByteArrayEncoding: #utf8) asHexString<br>
<br>
-Boris (via BlackBerry)<br>
<br>
----- Original Message -----<br>
From: <a href="mailto:seaside-bounces@lists.squeakfoundation.org">seaside-bounces@lists.squeakfoundation.org</a> &lt;<a href="mailto:seaside-bounces@lists.squeakfoundation.org">seaside-bounces@lists.squeakfoundation.org</a>&gt;<br>
To: Seaside - general discussion &lt;<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>&gt;<br>
Sent: Tue Sep 28 09:24:26 2010<br>
Subject: Re: [Seaside] Downloads and filenames with diacritics<br>
<br>
Yeah, we actually saw that possibility but I was hoping to make the app not to be forced to maintain the original name in the database (so it can't never be confused about it nor inject maintenance costs).<br>
<br>
What do you guys think about some other way to encode the filename that preserves the original (with diacritics) but for the OS (and xsendfile) it can look like a non-diacritical one?<br>
<br>
any ideas? (or encoders to suggest?)<br>
<br>
sebastian<br>
<br>
<br>
<br>
On Sep 28, 2010, at 1:11 PM, Miguel Cobá wrote:<br>
<br>
&gt; El mar, 28-09-2010 a las 13:03 -0300, Sebastian Sastre escribió:<br>
&gt;&gt; Hi guys,<br>
&gt;&gt;<br>
&gt;&gt; I've been using this:<br>
&gt;&gt;<br>
&gt;&gt; (GRCodec forEncoding: 'utf-8') encode: aFilaname<br>
&gt;&gt;<br>
&gt;&gt; just before writing an uploaded file (that probably has diacritics in its name).<br>
&gt;&gt;<br>
&gt;&gt; The thing is that xsendfile doesn't find the ones with diacritics and the download fails. Non diacritical downloads works just fine.<br>
&gt;&gt;<br>
&gt;&gt; As workaround I'm forcing filenames to be non-diacritical while we find a solution.<br>
&gt;&gt;<br>
&gt;&gt; Wonder if any of you guys have solved making your webapp to offer files download even when the filenames has diacriticals? I mean with xsendfile (from a seaside app of course).<br>
&gt;<br>
&gt; Store the files with numbers and save the original name in the database.<br>
&gt; Xsendfile the numbered file and state that the file should be offered<br>
&gt; with the original name. For example, in PHP:<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp; header("X-Sendfile: $numberedfile");<br>
&gt;&nbsp;&nbsp;&nbsp; header("Content-Type: application/octet-stream");<br>
&gt;&nbsp;&nbsp;&nbsp; header("Content-Disposition: attachment; file=\"$originalname\"");<br>
&gt;<br>
&gt; The downloaded file needs not to be the same name that the save as<br>
&gt; offered by the browser.<br>
&gt;<br>
&gt; Cheers<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; sebastian_______________________________________________<br>
&gt;&gt; seaside mailing list<br>
&gt;&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
&gt;<br>
&gt; --<br>
&gt; Miguel Cobá<br>
&gt; <a href="http://miguel.leugim.com.mx/">http://miguel.leugim.com.mx</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; seaside mailing list<br>
&gt; <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</font>
</p>

</div>
_______________________________________________<br>seaside mailing list<br><a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside<br></blockquote></div><br></div></body></html>