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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:21:36+00:00 2026-06-08T21:21:36+00:00

My environment is Ubuntu 12.04 Linux on i386. I can see that only UTF-8

  • 0

My environment is Ubuntu 12.04 Linux on i386. I can see that only UTF-8 locales are installed (in /var/lib/locales/supported.d/local):

de_DE.UTF-8 UTF-8
en_US.UTF-8 UTF-8
~

Now the problem:

TIdIOHandler.InitComponent calls TIdTextEncoding.Default which in turn calls TIdMBCSEncoding.Create(‘ASCII’).

And there, the line

FMaxCharSize := GetByteCount(PWideChar(@cValue[0]), 2);

is executed, and GetByteCount returns zero – which should not happen (the expected value is 1 because ASCII is a single-byte encoding).

The place which returns the zero value is line 2288 in IdGlobal:

if iconv(FFromUTF16, @LCharsPtr, @LCharCount, @LBytesPtr, {$IFNDEF KYLIX}@{$ENDIF}LByteCount) = size_t(-1) then
begin
  Result := 0;
  Exit;
end;

Could this be caused by a missing UTF-16 locale? (I did not succeed installing UTF-16 support in my first attempt and maybe this problem has been seen by other Indy users on Linux too)

  • 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-08T21:21:37+00:00Added an answer on June 8, 2026 at 9:21 pm

    Indy does not currently do adequate handling of iconv() errors because iconv() relies on platform-specific errno variables that are hard to implement in Indy across multiple platforms (this would not have been a problem if iconv() has been implemented to return its own error codes direcgtly). Not all iconv() errors are real failures, but Indy does not know that yet, so it treats all errors as failures (as for why GetByteCount() returns 0 on failure instead of raising an exception, this is because TIdTextEncoding is modeled after Embarcadero’s SysUtils.TEncoding class and thus has to be API-compatible with it. This will change in Indy 11).

    ICONV is supposed to implement its charsets natively, so it shouldn’t matter what locates are installed in the OS. In this case, I suspect that iconv() is failing to convert codepoint $10FFFD from UTF-16 to ASCII in TIdMBCSEncoding.Create() since it is outside the ASCII range, and this is one of those cases where Indy needs to look at errno to diffrentiate between a failure and partial conversion, but currently is not doing so.

    As a workaround, you can edit IdGlobal.pas to have the TIdTextEncoding.Default property getter use the TIdASCIIEncoding class instead of the TIdMBCSEncoding class, since Indy has its own ASCII implementation that is not dependant on ICONV.

    {$IFDEF HAS_CLASSPROPERTIES}
    class function TIdTextEncoding.GetDefault: TIdTextEncoding;
    {$ELSE}
    class function TIdTextEncoding.Default: TIdTextEncoding;
    {$ENDIF}
    var
      LEncoding: TIdTextEncoding;
    begin
      if GIdDefaultEncoding = nil then
      begin
        {$IFDEF USE_ICONV}
        //LEncoding := TIdMBCSEncoding.Create('ASCII');
        LEncoding := TIdASCIIEncoding.Create;
        {$ELSE}
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using startup scripts on Linux / Ubuntu, can I access environment variables such
My environment: Rails 3.2.x with RVM, Passenger, Apache on Linux (Ubuntu), I am not
Following is my environment: Linux, Ubuntu C++/gdb Eclipse I am implementing a TCP socket
I'm trying to building Synthetic Linux target with ECOS. My software environment: Ubuntu 11.4
environment: Ubuntu 9.10 Eclipse eclipse-jee-galileo-SR2-linux-gtk When I login the ubuntu,and run the eclipse, it
I'm an Ubuntu Linux user and I use Win XP only for my work
I am newbie to j2ee. I have download and installed j2eesdk-1_4_03-linux.bin in my ubuntu
[Environment: Ubuntu 10.04] I've just finished compiling Linux-2.6.20 and wanna make it work, so
Running Eclipse 3.5 (= Galileo) under (K)Ubuntu Linux 9.10 . Corporate environment with HTTP
How can I set a development environment for PHP on my Ubuntu (latest version)

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.