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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:54:25+00:00 2026-06-16T03:54:25+00:00

I need to address UTF-8 filenames with the php exec command. The problem is

  • 0

I need to address UTF-8 filenames with the php exec command. The problem is that the php exec command does not seem to understand utf-8. I use something like this:

echo exec('locale charmap');

returns ANSI_X3.4-1968

looking at this SO question, the solution lookes like that:

echo exec('LANG=de_DE.utf8; locale charmap'); 

But I still get the same output: ANSI_X3.4-1968

On the other hand – if I execute this php command on the bash command line:

php -r "echo exec('LANG=de_DE.UTF8 locale charmap');"

The output is UTF-8.
So the questions are:

  1. Why is there an different result be executing the php command at bash and at apache_module/web page?
  2. How to set UTF-8 for exec if it runs inside a website as apache module?
  • 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-16T03:54:27+00:00Added an answer on June 16, 2026 at 3:54 am

    To answer my own question – i found the following solution:

    setting the locale environment variable with PHP

    $locale='de_DE.UTF-8';
    setlocale(LC_ALL,$locale);
    putenv('LC_ALL='.$locale);
    echo exec('locale charmap');
    

    This sets to / returns UTF-8. So i’m able to pass special characters and umlauts to linux shell commands.

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

Sidebar

Related Questions

I need to check if my address has any words that matches word in
I need to get the server's IP address so that this can be sent
Do the db design(tables) need to address concerns other than persistence of the domain
I'd confidently say 99% of applications we write don't need to address more than
In one of my application in need client IP address in a WCF Service
I need to store IP address in the most compact way possible, searching is
i need grab to firefox address bar. how to get address bar url for
I need to take ip-address and port of clients in server. Server written on
I need to check the web address, using regular expression. If user type URL
i need grab to internet explorer address bar. how to get address bar url

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.