Transform's HTML subcommand: char 8218

Report problems with documented functionality
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Transform's HTML subcommand: char 8218

16 Oct 2017, 13:48

I've been getting strange results when trying to convert characters to their HTML equivalents. Specifically with Chr(8218), which should be sbquo.

Since this functionality is due to be removed in AHK v2, I'm trying to create a custom function to emulate it.

Code: Select all

;trigger this hotkey a few times to see different results for Chr(8218)
q:: ;test Transform's HTML subcommand
vOutput := ""
Loop, 10
{
	vIndex := 8215+A_Index+2 ;change +2 as required
	vText := Chr(vIndex)
	Transform, vHtml, HTML, % vText
	if !(vText = vHtml)
		vOutput .= vIndex "`t" vHtml "`r`n"
}
Clipboard := vOutput
MsgBox, % vOutput
return

Code: Select all

==============================
[start at 8216]
8216	‘
8217	’
8218	&ssquo; ;INCORRECT
8220	“
8221	”
8222	„
8224	†
8225	‡
==============================
[start at 8217]
8217	’
8218	&ssquo; ;INCORRECT
8220	“
8221	”
8222	„
8224	†
8225	‡
8226	•
==============================
[start at 8218]
8218	&s017 ;INCORRECT

8220	“
8221	”
8222	„
8224	†
8225	‡
8226	•
==============================
[start at 8219]
8220	“
8221	”
8222	„
8224	†
8225	‡
8226	•
==============================
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Transform's HTML subcommand: char 8218

16 Oct 2017, 14:23

Specifying a flag for the Transform command seems to help:
Transform, vHtml, HTML, % vText, 3

Code: Select all

8218	‚
8219	‛
8220	“
8221	”
8222	„
8223	‟
8224	†
8225	‡
8226	•
8227	‣

Return to “Bug Reports”

Who is online

Users browsing this forum: KruschenZ and 15 guests