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 8086173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:22:05+00:00 2026-06-05T18:22:05+00:00

Config: OS: Windows 7 (32 bits) DMD 2.58 using Phobos standard library My Intent:

  • 0

Config:

  • OS: Windows 7 (32 bits)
  • DMD 2.58 using Phobos standard library

My Intent:

I began to port a old package (10 modules) written back in 2007. It featured a full unicode support and I want to keep that capability.

Its author has written a specific module (class UnicodeBom(T)) for the purpose: A very involved approach (to my capacity at least, given that I am just an enthustiast and a beginner with only some C++/Qt/C# primer experience)!

I cleaned up any Tango code fragment from all the modules and succeeded to get to work on my box (at unit/module level for sure) only 4 modules out of 10 so far.


Code fragment:

this(Stream st) {
  void[] buf;
  buf.length = cast(uint) st.size;
  st.readBlock(buf.ptr, cast(uint) st.size);

  auto unicode = new UnicodeBom!(wchar)(Encoding.Unknown); // <<< to refactor
  mSourceBuffer = unicode.decode(buf); // <<< to refactor
}

where

  • st (parameter) is a std.stream.Stream
  • mSourceBuffer (private field) is a wchar[]

Quote:

Excerpt from code documentation related to final T[] decode (void[] content) method:

Convert the provided content. The content is inspected
for a BOM signature, which is stripped. An exception is
thrown if a signature is present when, according to the
encoding type, it should not be. Conversely, An exception
is thrown if there is no known signature where the current
encoding expects one to be present


My Question:

Is there an up to date and more idiomatic approach using out of the box Druntime and/or Phobos resources leading to the same outcome (namely loading UTF8/16/32 files and converting them to wchar[] without BOM)?

Thanks in advance.

  • 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-05T18:22:06+00:00Added an answer on June 5, 2026 at 6:22 pm

    I ended up succeeding to port all the modules to DMD 2.59 by fixing one by one all issues raised.

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

Sidebar

Related Questions

I'm using WiX to create a windows installer. Unfortunately my installer overwrites a config
I am using IIS V5.1. Integrated windows authentication I have a following web config:
Server Config: Windows Server 2003 IIS 6 ColdFusion 8 Standard Edition Java Version 6
linux: $HOME/.config windows: %APPDATA% mac os: $HOME/.config It can be set using http://qt-project.org/doc/qt-4.8/qsettings.html#setPath ,
I'm using a program that stores its log files at C:\Windows\System32\config\systemprofile\AppData\Roaming\ProgramName\*.log , but for
I'm using wxConfBase to save the data of my text box. (windows) config =
I have a windows service where the app.config file and the log4net.config files are
I have an app.Config that was created on the dev machine running Windows 7.
I have a windows service that has it's name set by an app.config. I
Is it possible to edit web.config file of my cloud app deployed on Windows

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.