CP-1252 in Golang

This article explains how to use the Code page 1252 (CP-1252) character in Golang. CP-1252 is single-byte character Latin Alphabet encoding. These characters are used by default in the legacy components of Microsoft Windows for English, Spanish, French, German/Scandinavian. 

CP-1252 code example

euroSign := '\u20AC' // -> euro sign unicode
fmt.Printf("Euro sign print format: %c\n", euroSign)

valueOnly := fmt.Sprintf("%c", euroSign) // If you only want the resulting string.
fmt.Println("Euro sign value: ", valueOnly)

CP-1252 table

UnicodeChar Unicode character description
\u0021!Exclamation Mark
\u0022Quotation Mark
\u0023#Number sign
\u0024$Dollar sign
\u0025%Percent sign
\u0028(Left Parenthesis
\u0029)Right Parenthesis
\u002b+Plus sign
\u002e.Full stop
\u00300Digit Zero
\u00311Digit One
\u00322Digit Two
\u00333Digit Three
\u00344Digit Four
\u00355Digit Five
\u00366Digit Six
\u00377Digit Seven
\u00388Digit Eight
\u00399Digit Nine
\u003c<Less-than sign
\u003d=Equals sign
\u003e>Greater-than sign
\u003f?Question Mark
\u0040@Commercial At
\u0041ALatin Capital Letter A
\u0042BLatin Capital Letter B
\u0043CLatin Capital Letter C
\u0044DLatin Capital Letter D
\u0045ELatin Capital Letter E
\u0046FLatin Capital Letter F
\u0047GLatin Capital Letter G
\u0048HLatin Capital Letter H
\u0049ILatin Capital Letter I
\u004aJLatin Capital Letter J
\u004bKLatin Capital Letter K
\u004cLLatin Capital Letter L
\u004dMLatin Capital Letter M
\u004eNLatin Capital Letter N
\u004fOLatin Capital Letter O
\u0050PLatin Capital Letter P
\u0051QLatin Capital Letter Q
\u0052RLatin Capital Letter R
\u0053SLatin Capital Letter S
\u0054TLatin Capital Letter T
\u0055ULatin Capital Letter U
\u0056VLatin Capital Letter V
\u0057WLatin Capital Letter W
\u0058XLatin Capital Letter X
\u0059YLatin Capital Letter Y
\u005aZLatin Capital Letter Z
\u005b[Left Square Bracket
\u005c\Reverse Solidus
\u005d]Right Square Bracket
\u005e^Circumflex accent
\u005f_Low Line
\u0060`Grave accent
\u0061aLatin Small Letter a
\u0062bLatin Small Letter b
\u0063cLatin Small Letter c
\u0064dLatin Small Letter d
\u0065eLatin Small Letter e
\u0066fLatin Small Letter f
\u0067gLatin Small Letter g
\u0068hLatin Small Letter h
\u0069iLatin Small Letter i
\u006ajLatin Small Letter j
\u006bkLatin Small Letter k
\u006clLatin Small Letter l
\u006dmLatin Small Letter m
\u006enLatin Small Letter n
\u006foLatin Small Letter o
\u0070pLatin Small Letter p
\u0071qLatin Small Letter q
\u0072rLatin Small Letter r
\u0073sLatin Small Letter s
\u0074tLatin Small Letter t
\u0075uLatin Small Letter u
\u0076vLatin Small Letter v
\u0077wLatin Small Letter w
\u0078xLatin Small Letter x
\u0079yLatin Small Letter y
\u007azLatin Small Letter z
\u007b{Left Curly Bracket
\u007c|Vertical Line
\u007d}Right Curly Bracket
\u20acEuro sign
\u201a,Single Low-9 Quotation Mark
\u0192ƒLatin small letter f with hook
\u201eDouble low-9 Quotation Mark
\u2026Horizontal Ellipsis
\u2021Double Dagger
\u02c6^Modifier letter circumflex accent
\u0230Per Mille Sign
\u0160ŠLatin capital letter s with caron
\u2039<Single left-pointing angle quotation mark
\u0152ŒLatin capital ligature OE
\u017dŽLatin capital letter z with Caron
\u2018`Left single quotation mark
\u2019Right single quotation mark
\u201cLeft double quotation mark
\u201dRight double quotation mark
\u2013En dash
\u2014Em dash
\u02dc˜Small tilde
\u2122Trade mark sign
\u0161šLatin small letter s with Caron
\u203aSingle right-pointing angle quotation mark
\u0153œLatin small ligature OE
\u017ežLatin small letter z with Caron
\u0178ŸLatin Capital letter Y with diaeresis
\u00a0No-break space
\u00a1¡Inverted exclamation mark
\u00a2¢Cent sign
\u00a3£Pound sign
\u00a4¤Currency sign
\u00a5¥Yen sign
\u00a6¦Broken bar
\u00a7§Section sign
\u00a9©Copyright sign
\u00aaªFeminine ordinal indicator
\u00ab«Left-pointing double angle quotation mark
\u00ac¬Not sign
\u00adSoft hypen
\u00ae®Registered sign
\u00b0°Degree sign
\u00b1±Plus-minus sign
\u00b2²Superscript two
\u00b3³Superscript three
\u00b4´Acute accent
\u00b5µMicro sign
\u00b6Pilcrow sign
\u00b7·Middle dot
\u00b9¹Superscript one
\u00baºMasculine ordinal indicator
\u00bb»Right-pointing double angle quotation mark
\u00bc¼Vulgar fraction one quarter
\u00bd½Vulgar fraction one half
\u00be¾Vulgar fraction three quarter
\u00bf¿Inverted question mark
\u00c0ÀLatin capital letter A with grave
\u00c1ÁLatin capital letter A with acute
\u00c2ÂLatin capital letter A with circumflex
\u00c3ÃLatin capital letter A with tilde
\u00c4ÄLatin capital letter A with diaeresis
\u00c5ÅLatin capital letter A with ring above
\u00c6ÆLatin capital letter AE
\u00c7ÇLatin capital letter C with cedilla
\u00c8ÈLatin capital letter E with grave
\u00c9ÉLatin capital letter E with acute
\u00caÊLatin capital letter E with circumflex
\u00cbËLatin capital letter E with diaeresis
\u00ccÌLatin capital letter I with grave
\u00cdÍLatin capital letter I with acute
\u00ceÎLatin capital letter I with circumflex
\u00cfÏLatin capital letter I with diaeresis
\u00d0ÐLatin capital letter ETH
\u00d1ÑLatin capital letter N with tilde
\u00d2ÒLatin capital letter O with grave
\u00d3ÓLatin capital letter O with acute
\u00d4ÔLatin capital letter O with circumflex
\u00d5ÕLatin capital letter O with tilde
\u00d6ÖLatin capital letter O with diaeresis
\u00d7×Multiplication sign
\u00d8ØLatin capital letter O with stroke
\u00d9ÙLatin capital letter U with grave
\u00daÚLatin capital letter U with acute
\u00dbÛLatin capital letter U with circumflex
\u00dcÜLatin capital letter U with diaeresis
\u00ddÝLatin capital letter Y with acute
\u00deÞLatin capital letter thorn
\u00dfßLatin small letter sharp s
\u00e0àLatin small letter a with grave
\u00e1áLatin small letter a with acute
\u00e2âLatin small letter a with circumflex
\u00e3ãLatin small letter a with tilde
\u00e4äLatin small letter a with diaeresis
\u00e5åLatin small letter a with ring above
\u00e6æLatin small letter AE
\u00e7çLatin small letter c with cedilla
\u00e8èLatin small letter e with grave
\u00e9éLatin small letter e with acute
\u00eaêLatin small letter e with circumflex
\u00ebëLatin small letter e with diaeresis
\u00ecìLatin small letter i with grave
\u00edíLatin small letter i with acute
\u00eeîLatin small letter i with circumflex
\u00efïLatin small letter i with diaeresis
\u00f0ðLatin small letter ETH
\u00f1ñLatin small letter n with tilde
\u00f2òLatin small letter o with grave
\u00f3óLatin small letter o with acute
\u00f4ôLatin small letter o with circumflex
\u00f5õLatin small letter o with tilde
\u00f6öLatin small letter o with diaeresis
\u00f7÷Division sign
\u00f8øLatin small letter O with stroke
\u00f9ùLatin small letter u with grave
\u00faúLatin small letter u with acute
\u00fbûLatin small letter u with circumflex
\u00fcüLatin small letter u with diaeresis
\u00fdýLatin small letter y with acute
\u00feþLatin small letter thorn
\u00ffÿLatin small letter y with diaeresis

Source code: GoDevTips repository

Follow us:

Leave a Reply

Your email address will not be published. Required fields are marked *