HTML character transfer

[expired user #6847]'s profile image [expired user #6847] posted 11 years ago in Import/Export Permalink
Using "Export grid rows->HTML table" of a view generated using the following code
CONCAT('<a href="', part.link, '"<', 'link', '></a>') AS 'Weblink'
generates a table line

<td class="col8"><a href="http://www.alliedelec.com/search/searchresults.aspx?dsNav=Ntk:Primary|203STBW|3|,Ny:True,Ro:0&dsDimensionSearch=D:203STBW,Dxm:All,Dxp:3&SearchType=0"<link></a></td>

where the <, > characters appearing in as <, > so the link does not work.

Please let me know your suggestions.
Thanks.
[expired user #6847]'s profile image [expired user #6847] posted 11 years ago Permalink
Unfortunately the browser rendered the characters right in the forum.

Again here are the converted <, > characters as the Notepad++ shows them & lt and & gt.
ansgar's profile image ansgar posted 11 years ago Permalink
Yes, such special characters are encoded by HeidiSQL, using their HTML entity representations. Normally you have non-HTML content in the cells, and when these contain < or >, that would break the exported table. The fact that you now have a situation in which you explicitly *want* these characters means you need a checkbox option. Something like "Encode special HTML characters", which you uncheck. Only I'm afraid another checkbox would start to overcrowd that simple dialog, doesn't it?
kalvaro's profile image kalvaro posted 11 years ago Permalink
HeidiSQL is doing it just fine:
<gt;
is the correct HTML representation of
<>
. It's not reasonable to expect that HeidiSQL or any other piece of software visually inspects your result set and decide that some arbitrary columns must be handled as raw HTML just because they have angle brackets.

BTW, running e.g. this:

SELECT CONCAT('<a href="', 'http://example.com', '"<', 'link', '></a>') AS 'Weblink'


... generates this:

<a href="http://example.com"<link></a>


... which is malformed HTML.
ansgar's profile image ansgar posted 11 years ago Permalink
Hehe, posted just 16 seconds one after the other :)
kalvaro's profile image kalvaro posted 11 years ago Permalink
P.S. Anse, since the forum software does not accept HTML tags at all, it should not treat strings that start with ampersand as HTML entities.
ansgar's profile image ansgar posted 11 years ago Permalink
Yes... that means entities need to be double encoded. Which again means currently entities are not double encoded, and that's a bit strange. Will check that.
[expired user #10763]'s profile image [expired user #10763] posted 7 years ago Permalink

Hello, I realize that this is an old thread. So, if I understand correctly, this cannot be done? Or can this be achieved by some clever escaping technique?

I too am trying to export a concatenated link.

Thanks

Please login to leave a reply, or register at first.