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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:10:02+00:00 2026-05-15T01:10:02+00:00

I am building a form that needs to accept characters encoded in SHIFT_JIS and

  • 0

I am building a form that needs to accept characters encoded in SHIFT_JIS and then send those results via email to a recipient. I’ve tried to simply capture the results from the $_POST variable and then to insert them into a block of text like this:

$NameJp = $_POST['NameJp'];
$contents = <<<TEST

Name: $NameJp

...
TEST

but that doesn’t appear to work (which doesn’t really surprise me). This is my first attempt at dealing with non-ASCII characters in PHP and I am hoping that people might have some suggestions. Perhaps I am missing a simple function to encode the text.

Also, are there any other potential pitfalls that I might encounter?

Thanks.

  • 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-15T01:10:03+00:00Added an answer on May 15, 2026 at 1:10 am

    Also, are there any other potential pitfalls that I might encounter?

    Yes. 🙂

    It’s all fine and good to receive text in SHIFT_JIS, but you’ll have to handle it like SHIFT_JIS all the way after that and inform everybody else that this text is in SHIFT_JIS. I.e., if you insert it into an email, you’ll need to set appropriate email headers informing clients that this email contains text in SHIFT_JIS. If you need to display it on a web page or just in debug, you’ll need to make sure the browser or debugging environment handles the text as SHIFT_JIS. If you mix it with other text, you should make sure they’re in the same encoding.

    Honestly, SHIFT_JIS is antiquated and terrible to work with. You should use UTF-8 if at all possible. If you absolutely, positively need to accept SHIFT_JIS and do a lot of work on it, you may want to convert it to UTF-8 internally and convert it back to whatever output encoding is necessary when the time comes. You can use iconv to do so.

    Email headers are special BTW in that they can not contain anything but ASCII characters. The subject of an email is part of the header. To send non-ASCII characters as a subject line, you’ll need to MIME encode it using mb_encode_mimeheader.

    Also, the obligatory reference to: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

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

Sidebar

Related Questions

I'm building an ASP.NET MVC application with a form that needs validation. The majority
I'm currently building a web form using APEX that is losely modelled after a
I am building a desktop application that needs to update current user's status frequently.
I'm building a form with php/mysql. I've got a table with a list of
I'm involved in building a donation form for non-profits. We recently got hit by
I'm building a Windows Forms form in C# with various elements in a panel
I'm building a dynamic ExtJS form based on JSON data loaded from an ASP.NET
I'm using jQuery validate on a form I am building and it is working
I want to use the jQuery accordion tool for a form i'm building so
(Using MySQL and PHP) I have a search form that will allow my users

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.