Export options not enconding correcly


#1

In my export configuration, I'm already using the $filename(test.txt,utf-8) format. But all functions, like $replace(%track%), are exporting "&" as "& amp;".

I've tried to change the coding to 16 or ANSI, but didn't work.

Am I missing something?


#2

You would have to show us more of the export script.

Is at least dubious syntax as it does not replace anything and I wonder where you find and ampersand in TRACK.


#3

It is exporting to be used as HTML

$filename(Table %album%.txt,utf-8)
    <center>
    <table cellpadding="0" cellspacing="0">
    <tbody>
    <tr><th>Nº&nbsp;</th>
    <th>Name</th>
    <th>Artist</th></tr>
    $loop(%_filename_ext%)
    <tr$if($odd($add(%_counter%,1)), class="even",)>
          <td>$replace(%track%)</td>
          <td>$replace(%title%)</td>
          <td>$replace(%artist%)</td></tr>
    $loopend()
    </tbody></table>

#4

As I said:

is more or less invalid syntax and leads in fact to an empty output.
In fact, the only thing that you get is:
`





<tr>
      <td></td>
      <td></td>
      <td></td></tr>

</tbody></table>`

So in short: I cannot reproduce your initial post. You would have to show the data that leads to the effect. (But I still think that the invalid $replace() spoils it all)

Nº  Name Artist

#5

Actually my loop is

$loop(%_filename_ext%)
<tr$if($odd($add(%_counter%,1)), class="even",)>
      <td>$replace(%track%,&,&amp;)</td>
      <td>$replace(%title%,&,&amp;)</td>
      <td>$replace(%artist%,&,&amp;)</td></tr>
$loopend()

But I don't remember what does &,&amp; mean, because I wrote it long time ago. But even writing only (%track%) will produce &amp; amp; instead of & in the exported txt file.


#6

It is probably intended to get some kind of html transcription for html meta characters.
the ampersand indicates special functions in html and so if you want to get a visible character, you have to use the transcription.
See e.g.
https://mrcoles.com/blog/how-use-amersands-html-encode/

Yet, I tried that loop and it replaces a single ampersand with &amp; as intended.
So what is the problem?

PS:
The list of problematic characters is by far not complete with just the ampersand.

  • ä -> &auml;
  • Ä -> &Auml;
  • ö -> &ouml;
  • Ö -> &Ouml;
  • ü -> &uuml;
  • Ü -> &Uuml;
  • ß -> &szlig;
  • € -> &euro;
  • & -> &amp;
  • < -> &lt;
  • > -> &gt;
  • „ -> &quot;
  • © -> &copy;
  • • -> &bull;
  • ™ -> &trade;
  • ® -> &reg;
  • § -> &sect;