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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:36:31+00:00 2026-05-24T18:36:31+00:00

I switched to utf-8 character set and here is a problem… step by step

  • 0

I switched to utf-8 character set and here is a problem…

step by step how it works (and it works!):

< textarea name=”comment” >blahblahblah< /textarea > —–> javascript event —–> sends blahblahblah text using ajax POST method —–> part1.php file receives $comment=$_POST[“comment”]; successfully and displays it with no problems on the html page below the textarea.

But everything is perfect if that text is not modified, or could be modified but should contain only English letters. otherwise, rectangles are on the page instead of cyrillic letters.

here is a code of part1.php and several results on html page:

$comment=$_POST["comment"];

echo $comment."|".strlen($comment)."|".substr($comment,0,1);

Entered in the textarea: “Hello”. Displayed below the textarea: hello|5|h //OK

Entered in the textarea: “Hello,Варна”. Displayed below the textarea: Hello,Варна|16|H //OK

Entered in the textarea: “Варна”. Displayed below the textarea: nothing, “Error on page” is displayed on the browser left down side as for javascript errors.

If I remove substr($comment,0,1) and write “Варна”, it will display Варна|10 without any mistakes.

Why is this happening so I can’t extract any part of that string to modify it?… Any ideas?

Thank you.

  • 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-24T18:36:31+00:00Added an answer on May 24, 2026 at 6:36 pm

    You should use mb_strlen and mb_substr.

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

Sidebar

Related Questions

Just switched over from eclipse to vs 2008 for debugging javascript, i feel more
I just switched to utf-8 for more characters, but I only store user posts
I have a problem with Google Maps in my Android app. I've switched to
I have a really weird WCF problem here... We're connecting to a crappy third-party
I have switched all html (and php) pages to utf-8. Before that everything looked
I switched to the dvorak keyboard layout about a year ago. I now use
I switched my DAL from using LINQ over to Entity Framework. Because my application
I switched lecturers today and he stated using a weird code to me. (He
I've switched over to a Mac recently and, although things have been going quite
I've recently switched to Linux on my work machine and, new to the Linux

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.