473,395 Members | 1,343 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,395 software developers and data experts.

assign japanese string to var

Following code contains japanese string that is assigned to variable
$str.
code
=============
<?php
$str = "$B%0%C%I%P%$%T%+%=(B";
?>
=========
When i am executing above program it gives me error as following.
Parse error: parse error, unexpected $ in
/var/www/html/bhavin/mohla1.2.2/b.php on line 3

Do anybody have solution for the above problem.
How can i assign above japanese string($B%0%C%I%P%$%T%+%=(B) to
variable without error.
Thank You
bhawin13

Jul 17 '05 #1
3 3063
bh******@indiatimes.com wrote:
Following code contains japanese string that is assigned to variable
$str.
code
=============
<?php
$str = "$B%0%C%I%P%$%T%+%=(J";
?>
=========
When i am executing above program it gives me error as following.
Parse error: parse error, unexpected $ in
/var/www/html/bhavin/mohla1.2.2/b.php on line 3

Do anybody have solution for the above problem.
How can i assign above japanese string($B%0%C%I%P%$%T%+%=(J) to
variable without error.


You're using Shift-JIS encoding, aren't you?

Don't. Use EUC-JP instead.

You're getting problems because the last character ("$B%=(J") encodes as
[&?131;] + [backslash] in shift-JIS encoding. PHP sees the backslash and
escapes your closing quite mark, so the rest of your PHP script is getting
swallowed up by the string. There are lots of other Shift-JIS characters
that cause the same problem.

In EUC-JP encoding, Japanese characters are all encoded with byte codes in
the range 161-255 (or thereabouts), so this problem never happens.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.et/phil.ronan/
Jul 17 '05 #2
Yes you are right.
I am using Shift-JIS charset.

Is there any solution for above problem with Shift-JIS charset?

Thank You
bhawin13

Jul 17 '05 #3
bhawin13 wrote:
Yes you are right.
I am using Shift-JIS charset.

Is there any solution for above problem with Shift-JIS charset?

I suppose you could add an extra backslash at the end of the string:

$str = "$B%0%C%I%P%$%T%+%=(J\";

It's messy, but it should work.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Daniel | last post by:
I'm trying to make a site work for japanese characters. It works fine except for the alerts in javascript. The characters are stored in unicode, as this; 'コミック全巻配' Those unicode characters...
2
by: Robert M. Gary | last post by:
I'm using JRE 1.5 on Solaris Japanese (Sparc). The JVM claims its default character set is EUC-JP I'm seeing two strange things when using Japanese character sets... 1) If I write a program that...
7
by: Daniel | last post by:
I`m trying to show japanese characters in an alert, like; alert('実装されていませ'); This doesn't work as shown in this post:...
4
by: tim | last post by:
Hi there! I am in Japan right now fiddeling with an JP to AD date change program, for this I have constructed one block where the date is inputted, and which decides wether it will go to the AD...
2
by: Joseph | last post by:
Hello. I have this problem. See I have a transformed XML file and I checked its contents prior to outputting it to excel file via responseset. here is the gist of the code: XmlReader reader =...
2
by: shefali | last post by:
Hi, The Tooltip text messages in my web app are not showing up in Japanese. They just show up as a string of squares in the browser... The text and errormessages display Japanese text. Here...
11
by: prats | last post by:
I want to write a GUI application in PYTHON using QT. This application is supposed to take in Japanese characters. I am using PyQt as the wrapper for using QT from python. I am able to take input...
1
by: schouwla | last post by:
Hi, I want to create dates in the following format: dd-MMM-yyyy e.g. 13- Mar-2007 But are seeing some problems when running on a Japanese Windows XP. Regional settings are set to JP. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.