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

  • Home
  • SEARCH
  • 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 1059447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:10:22+00:00 2026-05-16T18:10:22+00:00

We wrote a Delphi program that send some informations with CDO. In my Win7

  • 0

We wrote a Delphi program that send some informations with CDO.

In my Win7 machine (hungarian) the accents are working fine.

So if I sent a mail with “ÁÉÍÓÖŐÚÜŰ”, I got it in this format.
I used iso-8859-2 encoding in the body, and this encode the subject, and the email addresses to (the sender address is contains name).

I thought that I finished with this.

But when I try to send a mail from a Win2k3 english machine (the mailing server is same!), the result is truncate some accents:
Ű = U
Ő = O

Next I tried to use UTF-8 encoding here.

This provided accents – but wrong accents.

The mail contains accents with ^ signs.

ê <> é

This is not valid hungarian letter… 🙁

So I want to know, how to I convert or setup the input to I got good result.

I tried to log the body to see is changes…

Log(SBody);
Msg.Body := SBody;
Log(Msg.Body);

… or not.

But these logs are providing good result, the input is good.

So it is possible lost and misconverted on CDO generate the message.

May I can help the CDO if I can encode the ANSI text into real UTF.
But in Delphi converter functions don’t have “CodePage” parameters.
In Python I can said:

s.encode('iso-8859-2')

or

s.decode('iso-8859-2')

But in Delphi I don’t see this parameter.

Is anybody knows, how to preserve the accents, how to convert the accented hungarian strings to preserve them accented format?

And I want to know, can I check the result without sending the mail?

Thanks for your help:
dd

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

    a quick google search with “delphi string codepage” got me to torry’s delphi pages
    and maybe the following codesnippets (found here) can shed some light on your problem:

    {:Converts Unicode string to Ansi string using specified code page.
      @param   ws       Unicode string.
      @param   codePage Code page to be used in conversion.
      @returns Converted ansi string.
    }
    
    function WideStringToString(const ws: WideString; codePage: Word): AnsiString;
    var
      l: integer;
    begin
      if ws = ' then
        Result := '
      else 
      begin
        l := WideCharToMultiByte(codePage,
          WC_COMPOSITECHECK or WC_DISCARDNS or WC_SEPCHARS or WC_DEFAULTCHAR,
          @ws[1], - 1, nil, 0, nil, nil);
        SetLength(Result, l - 1);
        if l > 1 then
          WideCharToMultiByte(codePage,
            WC_COMPOSITECHECK or WC_DISCARDNS or WC_SEPCHARS or WC_DEFAULTCHAR,
            @ws[1], - 1, @Result[1], l - 1, nil, nil);
      end;
    end; { WideStringToString }
    
    
    {:Converts Ansi string to Unicode string using specified code page.
      @param   s        Ansi string.
      @param   codePage Code page to be used in conversion.
      @returns Converted wide string.
    }
    function StringToWideString(const s: AnsiString; codePage: Word): WideString;
    var
      l: integer;
    begin
      if s = ' then
        Result := '
      else 
      begin
        l := MultiByteToWideChar(codePage, MB_PRECOMPOSED, PChar(@s[1]), - 1, nil, 0);
        SetLength(Result, l - 1);
        if l > 1 then
          MultiByteToWideChar(CodePage, MB_PRECOMPOSED, PChar(@s[1]),
            - 1, PWideChar(@Result[1]), l - 1);
      end;
    end; { StringToWideString }
    

    –reinhard

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

Sidebar

Related Questions

HI: I've a Delphi 7 program that I wrote many years ago, but I've
I'm trying to convert an old Delphi program I wrote into Java to compile
I have a process that currently runs in a Delphi application that I wrote
I want to learn Delphi, does anyone know of a good free program that
I'm having a problem with a Delphi Pro 6 application that I wrote on
I'm currently working on a program to generate the hashes of files, in Delphi
I have a multi-threaded Delphi program creating multiple instance of some classes, and I
I had some code before I moved to Unicode and Delphi 2009 that appended
I am trying to create a Delphi 6 program with DSPACK that records audio
The problem is simple and strange! I wrote a program in Delphi and used

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.