question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

Leave un-printable characters escaped

See original GitHub issue

I love the idea of converting '\uE###' strings into the correct UTF8 character, but the following example doesnโ€™t really make sense:

before:

/**
 * Web-driver keys
 */
const KeyboardKeyEnum = {

    /**
     * NULL key
     */
    NULL: '\uE000',


    /**
     * Break key
     */
    BREAK: '\uE001',

    /**
     * Pause key
     */
    PAUSE: '\uE00B',

    /**
     * Help key
     */
    HELP: '\uE002',

    /**
     * Clear key
     */
    CLEAR: '\uE005',


    /**
     * Backspace key
     */
    BACKSPACE: '\uE003',

    /**
     * Escape key
     */
    ESCAPE: '\uE00C',

    /**
     * Tab key
     */
    TAB: '\uE004',


    /**
     * Return key (not enter)
     */
    RETURN: '\uE006',

    /**
     * Enter key (not return)
     */
    ENTER: '\uE007',


    /**
     * Shift key
     */
    SHIFT: '\uE008',

    /**
     * Control key
     */
    CONTROL: '\uE009',

    /**
     * Alternate key
     */
    ALT: '\uE00A',


    /**
     * Space-bar key
     */
    SPACE: '\uE00D',


    /**
     * Page-up key
     */
    PAGE_UP: '\uE00E',

    /**
     * Page-down key
     */
    PAGE_DOWN: '\uE00F',


    /**
     * End key
     */
    END: '\uE010',

    /**
     * Home key
     */
    HOME: '\uE011',


    /**
     * Left-arrow key
     */
    LEFT_ARROW: '\uE012',

    /**
     * Up-arrow key
     */
    UP_ARROW: '\uE013',

    /**
     * Right-arrow key
     */
    RIGHT_ARROW: '\uE014',

    /**
     * Down-arrow key
     */
    DOWN_ARROW: '\uE015',


    /**
     * Insert key
     */
    INSERT: '\uE016',

    /**
     * Delete key
     */
    DELETE: '\uE017',


    /**
     * Semicolon key
     */
    SEMICOLON: '\uE018',

    /**
     * Equals key
     */
    EQUALS: '\uE019',


    /**
     * number 0 on number-pad
     */
    NUMPAD0: '\uE01A',

    /**
     * number 1 on number-pad
     */
    NUMPAD1: '\uE01B',

    /**
     * number 2 on number-pad
     */
    NUMPAD2: '\uE01C',

    /**
     * number 3 on number-pad
     */
    NUMPAD3: '\uE01D',

    /**
     * number 4 on number-pad
     */
    NUMPAD4: '\uE01E',

    /**
     * number 5 on number-pad
     */
    NUMPAD5: '\uE01F',

    /**
     * number 6 on number-pad
     */
    NUMPAD6: '\uE020',

    /**
     * number 7 on number-pad
     */
    NUMPAD7: '\uE021',

    /**
     * number 8 on number-pad
     */
    NUMPAD8: '\uE022',

    /**
     * number 9 on number-pad
     */
    NUMPAD9: '\uE023',


    /**
     * "*" key
     */
    MULTIPLY: '\uE024',

    /**
     * "+" key
     */
    ADD: '\uE025',

    /**
     * "-" key
     */
    SUBTRACT: '\uE027',

    /**
     * "/" key
     */
    DIVIDE: '\uE029',

    /**
     * Separator key (Locale independent)
     */
    SEPARATOR: '\uE026',

    /**
     * "." key
     */
    DECIMAL: '\uE028',


    /**
     * F1 key
     */
    F1: '\uE031',

    /**
     * F2 key
     */
    F2: '\uE032',

    /**
     * F3 key
     */
    F3: '\uE033',

    /**
     * F4 key
     */
    F4: '\uE034',

    /**
     * F5 key
     */
    F5: '\uE035',

    /**
     * F6 key
     */
    F6: '\uE036',

    /**
     * F7 key
     */
    F7: '\uE037',

    /**
     * F8 key
     */
    F8: '\uE038',

    /**
     * F9 key
     */
    F9: '\uE039',

    /**
     * F10 key
     */
    F10: '\uE03A',

    /**
     * F11 key
     */
    F11: '\uE03B',

    /**
     * F12 key
     */
    F12: '\uE03C',


    /**
     * "Windows" key
     */
    WINDOWS: '\uE03D',

    /**
     * "Command" (Apple) key
     */
    COMMAND: '\uE03D'
};

export default KeyboardKeyEnum;

after:

/**
 * Web-driver keys
 */
const KeyboardKeyEnum = {
  /**
     * NULL key
     */
  NULL: '๎€€',
  /**
     * Break key
     */
  BREAK: '๎€',
  /**
     * Pause key
     */
  PAUSE: '๎€‹',
  /**
     * Help key
     */
  HELP: '๎€‚',
  /**
     * Clear key
     */
  CLEAR: '๎€…',
  /**
     * Backspace key
     */
  BACKSPACE: '๎€ƒ',
  /**
     * Escape key
     */
  ESCAPE: '๎€Œ',
  /**
     * Tab key
     */
  TAB: '๎€„',
  /**
     * Return key (not enter)
     */
  RETURN: '๎€†',
  /**
     * Enter key (not return)
     */
  ENTER: '๎€‡',
  /**
     * Shift key
     */
  SHIFT: '๎€ˆ',
  /**
     * Control key
     */
  CONTROL: '๎€‰',
  /**
     * Alternate key
     */
  ALT: '๎€Š',
  /**
     * Space-bar key
     */
  SPACE: '๎€',
  /**
     * Page-up key
     */
  PAGE_UP: '๎€Ž',
  /**
     * Page-down key
     */
  PAGE_DOWN: '๎€',
  /**
     * End key
     */
  END: '๎€',
  /**
     * Home key
     */
  HOME: '๎€‘',
  /**
     * Left-arrow key
     */
  LEFT_ARROW: '๎€’',
  /**
     * Up-arrow key
     */
  UP_ARROW: '๎€“',
  /**
     * Right-arrow key
     */
  RIGHT_ARROW: '๎€”',
  /**
     * Down-arrow key
     */
  DOWN_ARROW: '๎€•',
  /**
     * Insert key
     */
  INSERT: '๎€–',
  /**
     * Delete key
     */
  DELETE: '๎€—',
  /**
     * Semicolon key
     */
  SEMICOLON: '๎€˜',
  /**
     * Equals key
     */
  EQUALS: '๎€™',
  /**
     * number 0 on number-pad
     */
  NUMPAD0: '๎€š',
  /**
     * number 1 on number-pad
     */
  NUMPAD1: '๎€›',
  /**
     * number 2 on number-pad
     */
  NUMPAD2: '๎€œ',
  /**
     * number 3 on number-pad
     */
  NUMPAD3: '๎€',
  /**
     * number 4 on number-pad
     */
  NUMPAD4: '๎€ž',
  /**
     * number 5 on number-pad
     */
  NUMPAD5: '๎€Ÿ',
  /**
     * number 6 on number-pad
     */
  NUMPAD6: '๎€ ',
  /**
     * number 7 on number-pad
     */
  NUMPAD7: '๎€ก',
  /**
     * number 8 on number-pad
     */
  NUMPAD8: '๎€ข',
  /**
     * number 9 on number-pad
     */
  NUMPAD9: '๎€ฃ',
  /**
     * "*" key
     */
  MULTIPLY: '๎€ค',
  /**
     * "+" key
     */
  ADD: '๎€ฅ',
  /**
     * "-" key
     */
  SUBTRACT: '๎€ง',
  /**
     * "/" key
     */
  DIVIDE: '๎€ฉ',
  /**
     * Separator key (Locale independent)
     */
  SEPARATOR: '๎€ฆ',
  /**
     * "." key
     */
  DECIMAL: '๎€จ',
  /**
     * F1 key
     */
  F1: '๎€ฑ',
  /**
     * F2 key
     */
  F2: '๎€ฒ',
  /**
     * F3 key
     */
  F3: '๎€ณ',
  /**
     * F4 key
     */
  F4: '๎€ด',
  /**
     * F5 key
     */
  F5: '๎€ต',
  /**
     * F6 key
     */
  F6: '๎€ถ',
  /**
     * F7 key
     */
  F7: '๎€ท',
  /**
     * F8 key
     */
  F8: '๎€ธ',
  /**
     * F9 key
     */
  F9: '๎€น',
  /**
     * F10 key
     */
  F10: '๎€บ',
  /**
     * F11 key
     */
  F11: '๎€ป',
  /**
     * F12 key
     */
  F12: '๎€ผ',
  /**
     * "Windows" key
     */
  WINDOWS: '๎€ฝ',
  /**
     * "Command" (Apple) key
     */
  COMMAND: '๎€ฝ',
};

export default KeyboardKeyEnum;

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
vjeuxcommented, Jan 23, 2017

@FallenMax as of 0.0.11 (not yet published), we will leave the same escaping as it was in the original file. This way if you entered chinese characters unescaped, they will stayed unescaped. If you entered them escaped they will stayed escape.

This should solve most of the issues with unicode characters hopefully.

2reactions
FallenMaxcommented, Jan 23, 2017

Butโ€ฆCJK characters in string literals are also โ€˜non ascii charactersโ€™, and escaping them to ascii makes some code unreadable (and makes prettier unusable). Should we only escape un-printable characters? @vjeux @jlongster prett

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nonprintable and control characters are not escaped ... - GitHub
Strip unprintable characters, like Bash does. This sounds simple, but has unexpected complications. And a user might get confused or stuck onย ...
Read more >
Escape non-printing characters in a function for a Bash prompt
Adding " \[ " to the PS1 variable should escape those codes as non-printing, but if I do an echo in the function,...
Read more >
Escape sequences - IBM
You can represent any member of the execution character set by an escape sequence. They are primarily used to put nonprintable characters in...
Read more >
4.16 Escape special characters | R Markdown Cookbook
You need to escape the underscores if you want verbatim underscores instead of italic text. The way to escape a special character is...
Read more >
Using character escapes in markup and CSS - W3C
Character escapes are a way of writing a character in markup using only ASCII code points. They are useful if you are unable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found