Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8367691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:13:24+00:00 2026-06-09T13:13:24+00:00

I am writing currently a Flac-Decoder and so I have to read 2 UTF8

  • 0

I am writing currently a Flac-Decoder and so I have to read 2 UTF8 values encoded in the flac-header.
This is in the documentation:

if(variable blocksize)
   <8-56>:"UTF-8" coded sample number (decoded number is 36 bits)
else
   <8-48>:"UTF-8" coded frame number (decoded number is 31 bits) 

They use a selfmade function in their bitreader file Bitreader (line 1327) for the bigger UTF8 (variable blocksize).

I ve took a look on it and it is not that very nice code to translate into c#. So I thought about using the binaryreader with UTF8 Encoding and read with this method: ReadUint64.
Is it possible that this works? Is it the same result and what would be the absolutly fastest solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:13:26+00:00Added an answer on June 9, 2026 at 1:13 pm

    No, that will not work. ReadUInt64 will just read 8 bytes; the encoding is only used for reading actual text – i.e. ReadChar and ReadChars – and those will also not work, since the char type is only 16-bit, and neither of those would expect a 36-bit value anyway.

    When they write “UTF8 coded” in your documentation, that doesn’t mean it’s true UTF-8 – it just means they encode a number using the same principle as is used by UTF-8 to encode characters (which are, after all, also just numbers, but with more complex restrictions).

    If you look at Wikipedia, you will see that they have listed exactly how UTF-8 characters are encoded, for up to 31 bits. It is very straightforward to continue this sequence for a 36-bit value – in that case, the first byte would be 11111110 in binary – and that’s what you’re supposed to do for the sample numbers.

    While you may not think the code is nice, that’s pretty much the most sensible way to do it – you’re not going to avoid bit manipulation anyway, because of how UTF-8 works – and while it is certainly possible to make some variations on that exact code, the basic structure is unlikely to be very different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that output string must be utf8-formatted, I am writing currently
I am currently writing a Java compiler and have implemented section 15.12.2.7. of the
I'm currently writing a small script using pygame, but I don't believe this question
I am currently writing a distributed system using hazelcast. I have a few questions
I'm currently writing a small test Android app, and have run across a small
I'm currently writing an custom control which has to hold child control and have
I'm currently writing a Linux kernel module, and have problems implementing its communication with
I'm currently writing a program where I have a string of methods all set
I'm currently writing an app, what has an on-boot service. This service simply pops
I am currently writing a program using Weka that builds a model (using one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.