Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extended ASCII Characters 128-159 Not Displaying Correctly

    I am having trouble understanding why some of the extended ASCII characters don't display in Stata. Consider this loop that goes though ASCII codes and tries two methods of displaying them:

    Code:
    set more off
    foreach v of numlist 33(1)255  {
        display "`v': " uchar(`v') " OR " ustrfrom(char(`v'),"windows-1252",1)
    }
    Characters 128, 130-140, 142, 145-156, and 158-159 are not showing up for me using -uchar()-, though they are all printable. These are displayed correctly by -ustrfrom(char(`v'),"windows-1252",1)-.

    What I am having trouble getting my mind around is why this part of the extended ASCII characters fails, but latter part (including other currency symbols, like 163/£ and 165/¥) displays correctly?

  • #2
    uchar() takes the decimal value of the Unicode code point. If you look at the Latin-1 Supplement chart provide by Unicode Consortium at

    http://unicode.org/charts/PDF/U0080.pdf

    You'll see that 128 (hex 80), 130-140 (hex82-8c) are all control characters.


    Comment


    • #3
      Thanks for clarifying that. I failed to appreciate that there are several different variations of 8-bit ASCII table.

      Comment

      Working...
      X