473,382 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

mbstring settings for English/Japanese Environment

41
(A)

I am making a web application that needs to work in both an English/Japanese environment. This web application is intended to manage a company website (news releases, add new companies), and also contains an admin section available to administrators only. During my coding process I did not realize the existence of the mbstring functions since I am still fairly new to PHP. I am attempting to change the mbstring settings in the php.ini file however, I am not sure if it will give me the desired results.

I prefer to work with UTF-8 as I want to leave some room for development in the future.

THINGS I HAVE DONE SO FAR

1. I have made sure that my php, html charsets are utf-8 by setting the character sets in both the php header() and html meta tags.

2. I have attempted to use the following php.ini settings

Expand|Select|Wrap|Line Numbers
  1. [mbstring]
  2. ; language for internal character representation.
  3. mbstring.language = Neutral
  4.  
  5. ; internal/script encoding.
  6. ; Some encoding cannot work as internal encoding.
  7. ; (e.g. SJIS, BIG5, ISO-2022-*)
  8. mbstring.internal_encoding = UTF-8
  9.  
  10. ; http input encoding.
  11. mbstring.http_input = "auto"
  12.  
  13. ; http output encoding. mb_output_handler must be
  14. ; registered as output buffer to function
  15. mbstring.http_output = UTF-8
  16.  
  17. ; enable automatic encoding translation according to
  18. ; mbstring.internal_encoding setting. Input chars are
  19. ; converted to internal encoding by setting this to On.
  20. ; Note: Do _not_ use automatic encoding translation for
  21. ;       portable libs/applications.
  22. mbstring.encoding_translation = On
  23.  
  24. ; automatic encoding detection order.
  25. ; auto means
  26. ;mbstring.detect_order = auto
  27.  
  28. ; substitute_character used when character cannot be converted
  29. ; one from another
  30. ;mbstring.substitute_character = none;
  31.  
  32. ; overload(replace) single byte functions by mbstring functions.
  33. ; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
  34. ; etc. Possible values are 0,1,2,4 or combination of them.
  35. ; For example, 7 for overload everything.
  36. ; 0: No overload
  37. ; 1: Overload mail() function
  38. ; 2: Overload str*() functions
  39. ; 4: Overload ereg*() functions
  40. ;mbstring.func_overload = 0
  41.  
  42. ; enable strict encoding detection.
  43. ;mbstring.strict_encoding = Off
  44.  

3. Replaced str functions with mbstr functions where necessary.

Is there anything else I MUST do or SHOULD do in order to make this application work the way I want it to?

(B)
Questions

I am an absolute newb in encodings, so I have a very newbish question. When I set the mbstring.internal_encoding to UTF-8, does that mean the encoding of the actual script is UTF-8?

I am also using mysql (planning to use mysqli later on). Are these functions safe to use with UTF-8?

I know this may be a big topic, and I am not expecting a complete answer, but any help at all would be greatly appreciated.

ENVIRONMENT:

OS: Windows XP MEDIA CENTRE (ENGLISH with IME)
PHP EDITOR: DREAMWEAVER CS3, ZEND STUDIO 5.5, and sometimes plan old NOTEPAD when I am not on my own computer.
SERVER: WAMP SERVER 2.0
HOST: Probably will use a shared hosting company
Dec 13 '07 #1
1 2545
pbmods
5,821 Expert 4TB
Heya, Clai.

You should be good to go from there. PHP 6 will have greatly-enhanced Unicode support, but for now, you're doing all you can.

I am an absolute newb in encodings, so I have a very newbish question. When I set the mbstring.internal_encoding to UTF-8, does that mean the encoding of the actual script is UTF-8?
Nope. That one is set by your text editor.

I am also using mysql (planning to use mysqli later on). Are these functions safe to use with UTF-8?
Yup.

Be sure to set your connection encoding when you connect to MySQL:
Expand|Select|Wrap|Line Numbers
  1. mysql_query("SET NAMES 'utf-8'", $conn);
  2. mysql_query("SET CHARACTER SET 'utf-8'", $conn);
  3.  
Dec 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Benoit Martin | last post by:
in my windows app, I have some japanese text that I load from a text file and display on a label. No matter what type of encoding I try to use on the text file, the text always comes up as a bunch...
7
by: Fred Flintstone | last post by:
I'm writing a VB.Net windows forms application. This line of code: Personal.EffectiveDate = GridRow2.Cells("New Value").Value.ToString.Trim Fails with this error: Cast from string...
4
by: ShK | last post by:
Hi, phpMyAdmin gives following error message: "The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split...
3
by: news | last post by:
After installing phpMyAdmin on my Fedora Core 4 box, (Apache 2.0.54, PHP 5.0.4) we're getting this error: "The mbstring PHP extension was not found and you seem to be using a multibyte charset....
1
by: Earl77 | last post by:
My Son bought a toshiba laptop in Japan when he was teaching school over there, when he returned just recently to the Usa he wants to change the windows xp from Japanese to English. A person by the...
0
by: Pratik Patel | last post by:
Hi,OpenPNE is open source japanese social network. AND it's also have facility to transfer language in english in next version.but i see two site which is translated in english. can anyone help to...
0
by: =?Utf-8?B?ZGVuIDIwMDU=?= | last post by:
hi, I trying to export data display on a gridview that supports any language (like chinese, japanese, thai, french) shown here is chinese only. There is no problem exporting english language...
12
by: Steve Howell | last post by:
The never-ending debate about PEP 3131 got me thinking about natural languages with respect to Python, and I have a bunch of mostly simple observations (some factual, some anecdotal). I present...
6
by: Ole Nielsby | last post by:
Does C++ have a method of retrieving this? When launching my app, I want to select the appropriate language for ts GUI, based on the user's language setting. The frameworks wxWidgets and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.