473,786 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3080
bh******@indiat imes.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
10516
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 are translated by the browser, but not in the alert.
2
3355
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 does System.out.println("$^%$%^^" ); //assume those are Japanese characters that are multibyte under EUC-JP The resulting output looks NOTHING like the characters I typed in. Apparently the character set being used to read the literal is...
7
5747
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: http://groups.google.com/groups?hl=en&lr=&threadm=F2QCa.15007%24Xl.400929%40twister.rdc-kc.rr.com&rnum=2&prev=/groups%3Fq%3Djapanese%2Balert%26hl%3Den%26lr%3D%26group%3Dcomp.lang.javascript%26selm%3DF2QCa.15007%2524Xl.400929%2540twister.rdc-kc.rr.com%26rnum%3D2 This post implyes that it's possible to use the \uXXXX...
4
6168
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 to JP, or JP to AD change block.. Like so: public string ChangeDate(string tmpDate) { Match
2
3701
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 = myEsiCommand.ExecuteXmlReader(); reader.MoveToContent(); string myCSV = reader.ReadInnerXml(); //Load the xml fragment into the document XmlDocument xmlDataDoc = new XmlDocument();
2
2159
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 is how I have localized this: 1. set a culture attribute in web.config: culture=ja-JP
11
4769
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 in japanese. But I am unable to display them back to GUI. It displays some junk characters Can anyone suggest me some way how to debug the issue. The code used for tranferring data from view to document is: " codec =...
1
6525
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. Currently I am doing this DateTime dat = DateTime.Now;
0
9496
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.