How do I translate 8bit characters into 7bit characters? (i.e. Ü to U)

前端 未结 15 2020
旧时难觅i
旧时难觅i 2020-12-05 10:29

I\'m looking for pseudocode, or sample code, to convert higher bit ascii characters (like, Ü which is extended ascii 154) into U (which is ascii 85).

My initial gues

15条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 10:56

    The upper 128 characters do not have standard meanings. They can take different interpretations (code pages) depending on the user's language.

    For example, see Portuguese versus French Canadian

    Unless you know the code page, your "translation" will be wrong sometimes.

    If you are going to assume a certain code page (e.g. the original IBM code page) then a translation array will work, but for true international users, it will be wrong a lot.

    This is one reason why unicode is favored over the older system of code pages.

    Strictly speaking, ASCII is only 7 bits.

提交回复
热议问题