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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:46:11+00:00 2026-06-11T06:46:11+00:00

OS: Hungarian Windows (Windows 1250) Under Delphi 6 Prof there is no WideStringPos, WideStringCopy,

  • 0

OS: Hungarian Windows (Windows 1250)

Under Delphi 6 Prof there is no WideStringPos, WideStringCopy, WideStringReplace…

But in an XML based project I need to use them.

Because that I tried to write “something like” these functions.

But I’m not sure they are working as I want…

Because Delphi converts the Wide to Ansi and reverse in the background, I cannot be sure that my code is safe from these side effects… 🙂

The code is very primitive – I need the solution quickly…

 function WideStringCopy(WWhat : WideString; From, HowMany : integer) : WideString;
 var
     i : integer;
     l : integer;
     wc : WideChar;
 begin
     Result := '';

     if WWhat = ''
         then Exit;

     if (HowMany <= 0)
         then Exit;

     if  (From < 1)
         then From := 1;

     l := From + HowMany - 1;
     if l > Length(WWhat)
         then l := Length(WWhat);

     for i := From to l do begin
         wc := WWhat[i];
         Result := Result + wc;
     end;
 end;

 function WideStringPos(WWhere, WWhat : WideString) : integer;
 var
     wscomp : WideString;
     i : integer;
 begin
     Result := 0;
     for i := 1 to Length(WWhere) do begin
         wscomp := WideStringCopy(WWhere, i, LengtH(WWhat));
         if WideSameStr(wscomp, WWhat)
             then begin
                 Result := i;
                 Exit;
             end;
     end;
 end;

 function WideStringReplace(WWhere, WFrom, WTo : WideString) : WideString;
 var
     actpos : integer;
     wcomp : WideString;
     wc : WideChar;
 begin
     Result := '';
     actpos := 1;
     while actpos <= Length(WWhere) do begin
         wcomp := WideStringCopy(WWhere, actpos, Length(WFrom));
         if WideSameStr(wcomp, WFrom) then begin

             Result := Result + WTo;
             inc(actpos, Length(WFrom));

         end else begin

             wc := WWhere[actpos];
             Result := Result + wc;
             inc(actpos);

         end;
     end;
 end;

I have two questions about it:

  1. Do you see any piece of code that surely making bad result (converting the Wide to Ansi silently, and causing character loosing)?

  2. Do you know some character with I can test this code?

For example, chr(XXX) what is remaining when my converters are keeping the Wide rules, but loosing if I make wrong code…

Thanks for every info you will write…

  • 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-11T06:46:13+00:00Added an answer on June 11, 2026 at 6:46 am

    Do you know some character with I can test this code?

    Any codepage beyond Win1250 – for example Cyrillic Win1251, Greek, Hebrew – almost all letters there would be missed from 1250/1252

    You can take Jedi CodeLibrary and use its locale conversion routines: make a string consisting of #128 till #255 in some encoding like aforementioned, convert it to Unicode from that codepage and then convert back from Unicode to Hungarian codepage.

    function StringToWideStringEx(const S: AnsiString; CodePage: Word): WideString;
    function WideStringToStringEx(const WS: WideString; CodePage: Word): AnsiString;

    Or in one call

    function TranslateString(const S: AnsiString; CP1, CP2: Word): AnsiString;

    Then look which chars failed to translate and turned into ReplacementCharacter.


    However in JCL you’d have your Pos function and such ready to use. And XML parser. So why bother ?

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

Sidebar

Related Questions

I don't use hungarian (str, int) prefixes in .Net, but I still find it
I'm working on a legacy COM C++ project that makes use of system hungarian
I'm implementing the Hungarian algorithm in a project. I managed to get it working
I'm implementing the Hungarian algorithm in a project. I managed to get it working
I'm sorry but there can't be an example so we'll have to take a
I have trouble with Eclipse under Mac Os 10.7, with a Hungarian apple wireless
If this is Hungarian notation (CClass and IInterface), is there a way around it?
Is there good implementation of Hungarian algorithm in standard python libraries?
I've stopped using Hungarian notation everywhere except in the UI, where often I have
I have generally always used some sort of Hungarian Notation for my field names

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.