Coder Social home page Coder Social logo

Comments (1)

IepIweidieng avatar IepIweidieng commented on August 11, 2024 1

According to common/sys/big5.c:

  • Unicode code points without the corresponding Big5-UAO code point are always converted to 0xfffd (see u2b_table).
  • Big5-UAO code points 0xfeff-0xffff are left unchanged when converted into Unicode (see b2u_table).

Consider the case for strip_nonebig5: str is "\xff\xfdQ" and maxlen > 3.

When i is 0, both else if(str[i]==255) { and if(251<=str[i+1] && str[i+1]<=254) { hold, and the first i++ following them skips the byte \xff.

if(i+1<maxlen && str[i+1]) also holds, and the second i++ skips the byte \xfd.

However, the for loop also performs i++ after the continue and makes the byte Q ignored.

Therefore, the second i++ is redundant and erroneous. It makes the byte following "\xff\xfd" ignored.

Note that the UTF-8 encoding of U+FFFD is ef bf bd (binary: 11101111 10111111 10111101), but UTF-8 is only used for handling input and output for UTF-8 clients and is converted to Unicode code points internally, so it should be irrelevant to this issue.

Function usages of strip_nonebig5:

  • mbbsd/mbbsd.c: setup_utmp for user nickname display
  • mbbsd/bbs.c: readdoent for article title display

Only the displayed strings are processed through strip_nonebig5, while the strings which are stored to the disk are not affected.

from pttbbs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.