Omni Systems, Inc.

  

Mif2Go User's Guide, Version 55

  

Valid HTML 4.01!

 

Made with Mif2Go

21 Mapping text formats to HTML/XML > 21.6 Mapping special characters > 21.6.5 Mapping individual special characters


21.6.5 Mapping individual special characters

To force a mapping different from the Mif2Go mapping of a particular character, or to map any arbitrary Unicode character (for example):

[CharConvert]

; Unicode char num = HTML numeric value or string replacement

; nonbreaking hyphen is decimal 8209, becomes entity –

8209 = 150

; em space is x2003, becomes three nonbreaking spaces

x2003 =    

Character to replace

To the left of the equals sign, specify any of the following for the character you want to replace:

the decimal ASCII character code; you can find these codes in FrameMaker Character_Sets.pdf, in the OnlineManuals directory

the decimal Unicode character number

x followed by the hexadecimal code for the character

u+ or U+ followed by the hexadecimal code for the character

the character itself, if it is one of the following:

a character in the printable set other than the asterisk (*) or question mark (?), both of which Mif2Go treats as wildcards unless you disable this feature; see §5.1.7 Specifying how to treat cases, spaces, and wildcards

a high ASCII character (decimal code 128 through 159).

The easiest way to specify a character to be replaced (except asterisk or question mark) is to copy and paste the character from your FrameMaker document into section [CharConvert]. This works for most symbols, but not for variant spaces, which turn into plain spaces, nor for hard or soft hyphens, which turn into plain hyphens. For these characters, and for a few others, Table 21-2 shows the Unicode or other hexadecimal (and in some cases, decimal) value you can specify to the left of the equals sign.

Table 21-2 Special characters to replace for HTML/XML output

Category

Character to replace

Unicode/Hex

ASCII decimal

Quote marks

Low single quote

x201A

130

Left single quote

x2018

145

Right single quote

x2019

146

Low double quote

x201E

132

Left double quote

x201C

147

Right double quote

x201D

148

Spaces

Hard space

x00A0

160

En space

x2002

---

Em space

x2003

---

Numeric (figure) space

x2007

---

Thin space

x2009

---

Dashes

En dash

x2013

150

Em dash

x2014

151

Hyphens

Discretionary hyphen

x00AD

173

Nonbreaking hyphen

x2011

---

Wildcards

Asterisk

x002A

042

Question mark

x003F

063

Miscellaneous

Bullet

x2022

149

Fraction bar

x2044

---

Paragraph symbol

x00B6

182

Section symbol

x00A7

167

Replacement character

To the right of the equals sign, specify any of the following:

the decimal ASCII character code for the replacement character

x followed by the hexadecimal code for the replacement character

a string, which can include HTML code and Mif2Go macro references.

When you supply a string rather than a character code, Mif2Go expands any macros referenced, but includes the rest of the string in the output as is. Therefore you must escape any literal characters such as < by providing an entity reference instead; in this case, &lt;.

Examples

To map the bullet to a middle dot:

[CharConvert]

149 = 183

To map the bullet to a bold middle dot:

[CharConvert]

149 = <b>&#183;</b>

To map the bullet to an image:

[CharConvert]

149 = <img src="mybullet.gif">

To map the ohm symbol from Unicode to the Symbol font for HTML Help:

[CharConvert]

U+2126 = <span class="Symbol">W</span>

and add the class to your CSS:

[CSSEndMacro]

.Symbol {font-family: Symbol; }

In code-page encoding, as for HTML Help output, the only valid solution for handling out-of-range characters is to use a font that has the desired glyph within the code page. In this case, the glyph for ohm is in Symbol, which will work in all single-byte code pages (but not in Asian code pages, where an Asian symbol font is needed instead).

To prevent Mif2Go from mapping the curly right single quote to its corresponding HTML entity, and replace it instead with a straight apostrophe (which is in the printable set):

[CharConvert]

146 = '

Use only to map non-printable characters

Although you can specify any decimal integer to the left of the equals sign, this mapping option is intended only for characters that are not in the regular printable set. Using [CharConvert] to map a character in the printable set can result in surprises. You can try mapping other integers, but the odds are poor for values not in the range 128 through 255. There are a few exceptions. For example, Mif2Go automatically converts a solidus to a forward slash, which is in the printable set. You can prevent this conversion by mapping the solidus to itself, specifying the Unicode value to the left of the equals sign and again on the right, as a numeric entity reference:

[CharConvert]

8260 = &#8260;

See §21.6.1 Understanding how Mif2Go represents characters.

Font is ignored

Character mapping via [CharConvert] takes no notice of font. For example, if you map a character that appears as a check mark in WingDings 2 to the Unicode radical sign, any instance of capital “P” in your document that occurs by itself (away from other letters, or with a character format applied to it alone) will appear as a radical sign in HTML output. This is because in the WingDings 2 character set, the check mark has ASCII decimal code 80, the same code as a capital “P” in the standard character set:

[CharConvert]

; WingDings 2 check marks (and individual text Ps) become radicals:

80 = 8730 

To get around this problem, see §21.6.6 Mapping characters in a special font.



21 Mapping text formats to HTML/XML > 21.6 Mapping special characters > 21.6.5 Mapping individual special characters