Skip to content

Instantly share code, notes, and snippets.

@robcowie
Created July 22, 2020 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robcowie/73bd45b5d575f161beb11998b1e00739 to your computer and use it in GitHub Desktop.
Save robcowie/73bd45b5d575f161beb11998b1e00739 to your computer and use it in GitHub Desktop.
Allowed characters for Amazon entities and keywords
# From https://advertising.amazon.com/API/docs/en-us/get-started/how-to-use-api#Keyword-bid-constraints-by-marketplace
# Broken decoding fixed, mostly. We've lost a few characters but they seem obscure.
# See http://www.i18nqa.com/debug/utf8-debug.html for explanation
ALLOWED_ENTITY_CHARS = {
"'",
' ',
'!',
'"',
'#',
'$',
'%',
'&',
'(',
')',
'*',
'+',
',',
'-',
'.',
'/',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
':',
';',
'<',
'=',
'>',
'?',
'@',
'[',
'\\',
']',
'_',
'`',
'A',
'a',
'B',
'b',
'C',
'c',
'D',
'd',
'E',
'e',
'F',
'f',
'G',
'g',
'H',
'h',
'I',
'i',
'J',
'j',
'K',
'k',
'L',
'l',
'M',
'm',
'N',
'n',
'O',
'o',
'P',
'p',
'Q',
'q',
'R',
'r',
'S',
's',
'T',
't',
'U',
'u',
'V',
'v',
'W',
'w',
'X',
'x',
'Y',
'y',
'Z',
'z',
'{',
'}',
'~',
'®',
'ß',
'À',
'Á',
'á',
'Â',
'â',
'Ä',
'ä',
'Æ',
'æ',
'Ç',
'ç',
'È',
'è',
'É',
'é',
'Ê',
'ê',
'Ë',
'ë',
'Í',
'í',
'Î',
'î',
'Ï',
'ï',
'Ñ',
'ñ',
'Ó',
'ó',
'Ô',
'ô',
'Ö',
'ö',
'Ù',
'ù',
'Ú',
'ú',
'Û',
'û',
'Ü',
'ü',
'ÿ',
'Ÿ',
'Œ',
'œ',
}
ALLOWED_KEYWORD_CHARS = {
"'",
' ',
'&',
'',
'+',
'-',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'\n',
'\t',
'A',
'a',
'B',
'b',
'C',
'c',
'D',
'd',
'E',
'e',
'F',
'f',
'G',
'g',
'H',
'h',
'I',
'i',
'J',
'j',
'K',
'k',
'L',
'l',
'M',
'm',
'N',
'n',
'O',
'o',
'P',
'p',
'Q',
'q',
'R',
'r',
'S',
's',
'T',
't',
'U',
'u',
'V',
'v',
'W',
'w',
'X',
'x',
'Y',
'y',
'Z',
'z',
'®',
'ß',
'À',
'Á',
'á',
'Â',
'â',
'Ä',
'ä',
'Æ',
'æ',
'Ç',
'ç',
'È',
'è',
'É',
'é',
'Ê',
'ê',
'Ë',
'ë',
'Í',
'í',
'Î',
'î',
'Ï',
'ï',
'Ñ',
'ñ',
'Ó',
'ó',
'Ô',
'ô',
'Ö',
'ö',
'Ù',
'ù',
'Ú',
'ú',
'Û',
'û',
'Ü',
'ü',
'ÿ',
'Ÿ',
'Œ',
'œ',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment