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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:17:22+00:00 2026-06-07T00:17:22+00:00

Win7-HUN, UTF8 PHP file. function Test($Msg){ $Result = ; $ReplFrom = ő; $ReplTo =

  • 0

Win7-HUN, UTF8 PHP file.

function Test($Msg){

 $Result = "";
 $ReplFrom = "ő";
 $ReplTo = "ö";

 for($i=0; $i<mb_strlen($Msg); $i++){
 $c = mb_substr($Msg, $i, 1);
 echo($c);echo("<br>");
 }
}

Test('őű');

This showing good: “őű”

I want to replace “ő” with “ö” but one-by-one, because I want to check many other things.

function Test($Msg){

 $Result = "";
 $ReplFrom = "ő";
 $ReplTo = "ö";

 for($i=0; $i<mb_strlen($Msg); $i++){
 $c = mb_substr($Msg, $i, 1);
 $add = $c;
 $h = mb_substr($ReplFrom, 0, 1);
 if ($c == $h) {
 $add = $ReplTo;
 echo("found");
 }
 $Result = $Result.$add;
 }

 return $Result;

} 

Interesting that is found all chars, and the result is wrong.

Simplified to concat:

 $what = 'ő';
 $replto = "ö";
 echo($what.$replto); 

This is good.

 $what = mb_substr('ő', 0, 1);
 $replto = mb_substr("ö", 0, 1);
 echo($what.$replto); 

This is wrong.

What I do wrong?
I want to step in every MB character, and check it. If some of them needed, I must replace.
If some of them illegal, replace them with ” “. Etc.
And at the end concat to one string.

for example:
“álmos ő körben + 2”
“álmos ö körben 2”

But something is wrong in my code.
I want to use UTF8 chars, because I have MultiByte input, and UTF8 or 16 XML.
And some of the servers are english, some of hungarian (encoding is different).

But interesting that something is get wrong when I want to working with MB chars.
Maybe the concatentation causes this?

Very-very thanks for every advance in this theme!

Regards:
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-06-07T00:17:24+00:00Added an answer on June 7, 2026 at 12:17 am

    You probably need to specify encoding for mb_ functions.

    $c = mb_substr($Msg, $i, 1,'utf-8');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following call returns a result in WinXP but not on Win7: using (WebClient
I'm using win7. and i have website which i want to test it with
running on localhost win7 xampp , this code comes up with error $source =
http://121.199.111.177 I access this URL using win7(IE8), it's ok, I can get the page.
I am running Win7 and have created Rails 3 apps on this box and
I am using ccl under win7 OS, I call run-program function in ccl console
i use win7 + VS2008 PRO to edit my blog (php) and i can't
I installed easyphp on win7 and added the php directory to my path. When
Running visual c++ 2010 on 64bit win7, this line #include C:\Windows\SysWOW64\user32.dll its the correct
I think I tried everything on my Win7 64 machine but still got this

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.