2 added 1525 characters in body

# GolfScript, 16 bytes

{64/2=}%1,/{,)}*


Try it online!

### Background

GolfScript doesn't have a clue what Unicode is; all strings (input, output, internal) are composed of bytes. While that can be pretty annoying, it's perfect for this challenge.

UTF-8 encodes ASCII and non-ASCII characters differently:

• All code points below 128 are encoded as 0xxxxxxx.

• All other code points are encoded as 11xxxxxx 10xxxxxx ... 10xxxxxx.

This means that the encoding of each Unicode character contains either a single 0xxxxxxx byte or a single 11xxxxxx byte and 1 to 5 10xxxxxx bytes.

By dividing all bytes of the input by 64, we turn 0xxxxxxx into 0 or 1, 11xxxxxx into 3, and 10xxxxxx into 2.

If we compare the quotient with 2 – pushing 1 for 2; and 0 for 0, 1, and 3 – each character will be turned into a 0, followed by 1 to 5 1's.

All that's left is to split the resulting string at occurrences of 0, count the number of 1's between those zeroes and add one to the amount.

### How it works

{     }%          Map the following over all bytes in the input.
64/                Divide the byte by 64.
2=              Compare the quotient with 2, pushing 1 or 0.
1,        Push range(1), i.e., [0].
/       Split the array of Booleans around zeroes.
{  }*  Fold; for each run of ones but the first:
,       Push its length.
)      Increment.


# GolfScript, 16 bytes

{64/2=}%1,/{,)}*


Try it online!

# GolfScript, 16 bytes

{64/2=}%1,/{,)}*


Try it online!

### Background

GolfScript doesn't have a clue what Unicode is; all strings (input, output, internal) are composed of bytes. While that can be pretty annoying, it's perfect for this challenge.

UTF-8 encodes ASCII and non-ASCII characters differently:

• All code points below 128 are encoded as 0xxxxxxx.

• All other code points are encoded as 11xxxxxx 10xxxxxx ... 10xxxxxx.

This means that the encoding of each Unicode character contains either a single 0xxxxxxx byte or a single 11xxxxxx byte and 1 to 5 10xxxxxx bytes.

By dividing all bytes of the input by 64, we turn 0xxxxxxx into 0 or 1, 11xxxxxx into 3, and 10xxxxxx into 2.

If we compare the quotient with 2 – pushing 1 for 2; and 0 for 0, 1, and 3 – each character will be turned into a 0, followed by 1 to 5 1's.

All that's left is to split the resulting string at occurrences of 0, count the number of 1's between those zeroes and add one to the amount.

### How it works

{     }%          Map the following over all bytes in the input.
64/                Divide the byte by 64.
2=              Compare the quotient with 2, pushing 1 or 0.
1,        Push range(1), i.e., [0].
/       Split the array of Booleans around zeroes.
{  }*  Fold; for each run of ones but the first:
,       Push its length.
)      Increment.

1

# GolfScript, 16 bytes

{64/2=}%1,/{,)}*


Try it online!