+EXTCONST unsigned char PL_utf8skip[];
+#endif
+
+END_EXTERN_C
+#define UTF8SKIP(s) PL_utf8skip[*(U8*)s]
+
+/* Native character to iso-8859-1 */
+#define NATIVE_TO_ASCII(ch) (ch)
+#define ASCII_TO_NATIVE(ch) (ch)
+/* Transform after encoding */
+#define NATIVE_TO_UTF(ch) (ch)
+#define UTF_TO_NATIVE(ch) (ch)
+/* Transforms in wide UV chars */
+#define UNI_TO_NATIVE(ch) (ch)
+#define NATIVE_TO_UNI(ch) (ch)
+/* Transforms in invariant space */
+#define NATIVE_TO_NEED(enc,ch) (ch)
+#define ASCII_TO_NEED(enc,ch) (ch)
+
+/* As there are no translations avoid the function wrapper */
+#define Perl_utf8n_to_uvchr Perl_utf8n_to_uvuni
+#define Perl_uvchr_to_utf8 Perl_uvuni_to_utf8
+
+/*
+
+ The following table is from Unicode 3.2.
+
+ Code Points 1st Byte 2nd Byte 3rd Byte 4th Byte
+
+ U+0000..U+007F 00..7F
+ U+0080..U+07FF C2..DF 80..BF
+ U+0800..U+0FFF E0 A0..BF 80..BF
+ U+1000..U+CFFF E1..EC 80..BF 80..BF
+ U+D000..U+D7FF ED 80..9F 80..BF
+ U+D800..U+DFFF ******* ill-formed *******
+ U+E000..U+FFFF EE..EF 80..BF 80..BF
+ U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
+ U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
+ U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
+
+Note the A0..BF in U+0800..U+0FFF, the 80..9F in U+D000...U+D7FF,
+the 90..BF in U+10000..U+3FFFF, and the 80...8F in U+100000..U+10FFFF.
+The "gaps" are caused by legal UTF-8 avoiding non-shortest encodings:
+it is technically possible to UTF-8-encode a single code point in different
+ways, but that is explicitly forbidden, and the shortest possible encoding
+should always be used (and that is what Perl does).
+
+ */
+
+/*
+ Another way to look at it, as bits:
+
+ Code Points 1st Byte 2nd Byte 3rd Byte 4th Byte
+
+ 0aaaaaaa 0aaaaaaa
+ 00000bbbbbaaaaaa 110bbbbb 10aaaaaa
+ ccccbbbbbbaaaaaa 1110cccc 10bbbbbb 10aaaaaa
+ 00000dddccccccbbbbbbaaaaaa 11110ddd 10cccccc 10bbbbbb 10aaaaaa
+
+As you can see, the continuation bytes all begin with C<10>, and the
+leading bits of the start byte tell how many bytes the are in the
+encoded character.
+
+*/
+
+
+#define UNI_IS_INVARIANT(c) (((UV)c) < 0x80)
+#define UTF8_IS_INVARIANT(c) UNI_IS_INVARIANT(NATIVE_TO_UTF(c))
+#define NATIVE_IS_INVARIANT(c) UNI_IS_INVARIANT(NATIVE_TO_ASCII(c))
+#define UTF8_IS_START(c) (((U8)c) >= 0xc0 && (((U8)c) <= 0xfd))
+#define UTF8_IS_CONTINUATION(c) (((U8)c) >= 0x80 && (((U8)c) <= 0xbf))
+#define UTF8_IS_CONTINUED(c) (((U8)c) & 0x80)
+#define UTF8_IS_DOWNGRADEABLE_START(c) (((U8)c & 0xfc) == 0xc0)
+
+#define UTF_START_MARK(len) ((len > 7) ? 0xFF : (0xFE << (7-len)))
+#define UTF_START_MASK(len) ((len >= 7) ? 0x00 : (0x1F >> (len-2)))
+
+#define UTF_CONTINUATION_MARK 0x80
+#define UTF_ACCUMULATION_SHIFT 6
+#define UTF_CONTINUATION_MASK ((U8)0x3f)
+#define UTF8_ACCUMULATE(old, new) (((old) << UTF_ACCUMULATION_SHIFT) | (((U8)new) & UTF_CONTINUATION_MASK))
+
+#define UTF8_EIGHT_BIT_HI(c) ((((U8)(c))>>UTF_ACCUMULATION_SHIFT)|UTF_START_MARK(2))
+#define UTF8_EIGHT_BIT_LO(c) (((((U8)(c)))&UTF_CONTINUATION_MASK)|UTF_CONTINUATION_MARK)
+
+#ifdef HAS_QUAD
+#define UNISKIP(uv) ( (uv) < 0x80 ? 1 : \
+ (uv) < 0x800 ? 2 : \
+ (uv) < 0x10000 ? 3 : \
+ (uv) < 0x200000 ? 4 : \
+ (uv) < 0x4000000 ? 5 : \
+ (uv) < 0x80000000 ? 6 : \
+ (uv) < UTF8_QUAD_MAX ? 7 : 13 )
+#else
+/* No, I'm not even going to *TRY* putting #ifdef inside a #define */
+#define UNISKIP(uv) ( (uv) < 0x80 ? 1 : \
+ (uv) < 0x800 ? 2 : \
+ (uv) < 0x10000 ? 3 : \
+ (uv) < 0x200000 ? 4 : \
+ (uv) < 0x4000000 ? 5 : \
+ (uv) < 0x80000000 ? 6 : 7 )