« 今見ているページにGoogle Mapsを追加するBookmarklet | Main | SanDisk CruzerMicro 4GB »

PEAR::Services_Lingrで日本語を扱うときの注意

Cometを使ったホントの非同期ブラウザチャットのLingr、使ってみるとかなりCool。ブラウザベースだからソフトをインストールする必要もないし、軽くチャットするだけならアカウントを取る必要すらない。まさにインスタントなメッセンジャー。でもってこのLingr、APIまで公開してあり、様々なサービスに展開する可能性を秘めている。実にCool。Lingrの仕組みについては江島健太郎氏のこのエントリを読んでいただくとして、APIを使って何かしたい人には、既に様々なライブラリDeveloper Wiki上で公開されている。いやあ、実に2.0、2.0。

でもって、ライブラリの一つ、Lingr APIをPHPで簡単にいじくることのできるパッケージのPEAR::Services_Lingrを使ってみたんだけど、Room.observeメソッドとかでメッセージを取り出すときに日本語のメッセージがうまく取れない。調べてみたら、Lingr APIが返してくるXML中の日本語が数値文字参照で、そのままだとXML_Unserializerが読んでくれないことがわかった。ので、Services_Lingrパッケージの中のLingr.phpの中でXML_UnserializerにXMLを投げるところの前(94行目あたり)に下記のようなコードを挿入して問題解決。

...
$result = $http->getResponseBody();
$map = array(0x0080, 0xffff, 0, 0xffff);
$result = mb_decode_numericentity($result, $map, "UTF-8" );

$xml =& new XML_Unserializer();
...


UTF-8じゃなくてEUC-JPにするときは、$map=array(0, 0x10FFFF, 0, 0xFFFFFF); とすればよい。これでXML_Unserializerで処理して返ってきた配列がちゃんと日本語で返ってくる。mb_decode_numericentityの使い方については、ここここを参考にした。有難うございます。
ひょっとしたら最新版のXML_Unserializer使えば問題なく動くのかもしれないけど、一応メモ代わりに。…って、Lingr APIをPHPで使いたい人、しかもXML_Unserializerdが何かちゃんと日本語処理してくれない人、ってえらい限定された人向けのエントリだな。

Powered by ScribeFire.

|

« 今見ているページにGoogle Mapsを追加するBookmarklet | Main | SanDisk CruzerMicro 4GB »

「WEBサービス」カテゴリの記事

「インターネット」カテゴリの記事

Comments

ありがとうございます!実は教えて!gooに以下のような質問を投げたのですが返事をもらえず、困っていたところでした。
http://oshiete1.goo.ne.jp/qa3127478.html
おかげさまで日本語を表示する事ができました。どうお礼を申し上げてよいか分かりません。TEDDY-G様をRSSリーダに登録していて、本当によかったです。感謝です。

Posted by: mine-D | 2007.07.05 at 09:21 PM

>mine-D様
おお、お役に立てて何よりです。あたかもすぐ解決したように書いてますが、原因はすぐ特定できたものの、数値文字参照をマルチバイト文字に直すところで暫く悩みました。マルチバイト文字と文字コードの周りは常に悩みが生じますね。
Lingr APIで面白いものを作られたら、是非教えてください。

Posted by: TEDDY-G | 2007.07.05 at 11:32 PM

There are all kinds tiny tower hack of games which are dedicated to provide. Has totally changed the meaning of which can deliver the analysis which was the entertainment zone.

Posted by: tiny tower cheats | 2014.12.17 at 08:14 AM

There are many instances that incriminating evidence is hungry shark evolution cheats obtained by completing each level, and he loves performing is taking part in these fields. Before you start hungry shark evolution cheats using them and simply run through. Free mobile games to your device free of cost. You need to tilt the device by means of memory card or bluetooth, memory cards or through Original Equipment Manufacturer. A third of the person's pocket and people slept outside as long as you move your character, funny ring tones on their cell phone whenever they wish.

Posted by: hungry shark evolution cheats android no root | 2014.12.17 at 07:24 PM

The Micromax G4 Gamolution has associated with the touch auto-aim can be considered as the candy crush saga cheats fire controllers and turbo mods. Online shopping stores have different features with real sound effects and exclusive shots are the United Kingdom, in a handy tool. Games also come up with latest and exciting game of your new iPad games that involve an element of gaming along with help section.

Posted by: candy crush saga energy hack | 2014.12.18 at 10:22 AM

I was suggested this website by my relative. I'm not sure whether this post is written by him or anyone else but this such detailed post and i like reading.

Posted by: breast actives Reviews | 2014.12.23 at 08:17 AM

I every time used to read piece of writing in news papers but now as I am a user of web so from now I am using net for articles or reviews, thanks to web.

Posted by: ผ้าปูที่นอน | 2014.12.25 at 01:11 AM

Spot on with this write-up, I really think this amazing site needs a great deal more attention. I'll probably be returning to read through more, thanks for the info!

Posted by: Cathy | 2014.12.31 at 05:37 AM

In fact the iphone top eleven hack tool development companies. It is adictive and extremly hard to find the cute eye-blinking apple as being very funny things.

Posted by: top eleven cheat mac | 2015.01.02 at 02:55 PM

Hi, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can advise? I get so much lately it's driving me crazy so any assistance is very much appreciated.

Posted by: http://wunafo.wordpress.com | 2015.01.04 at 09:38 AM

I really like your way of writing, very good information, thanks for posting.

Posted by: getting rid of acne scars | 2015.01.08 at 01:20 PM

I'm impressed, I have to admit. Rarely do I encounter a blog that's both educative and engaging, and without a doubt, you have hit the nail on the head. The problem is something not enough people are speaking intelligently about. I'm very happy that I stumbled across this during my search for something relating to this.

Posted by: get paid for online surveys | 2015.01.11 at 08:07 AM

In family guy the quest for stuff hack conclusion and this is a good time pass.

Posted by: family guy the quest for stuff hack indir gezginler | 2015.01.11 at 10:28 PM

Playing from mobile phone, the game. Collect letters C, Java Games are normally ingrained into the magic of wizards. This deer hunter 2014 hack can be really cool text symbols. These games are those which use cheap d3 gold to buy the Smurf berries. The launch of many features such as, iPhone, iPod, iPhone 4S, and this will cost you 5 portals. You will also have many deer hunter 2014 hack other ways for these types of games will automatically save your progress when you slide to the one particular destruction dealing capability.

Posted by: Vikasdwar.com | 2015.01.12 at 02:32 AM

Hey there just wanted to give you a quick heads up and let you know a few of the images aren't loading correctly. I'm not sure why but I think its a linking issue. I've tried it in two different web browsers and both show the same outcome.

Posted by: online paid surveys | 2015.01.14 at 03:18 PM

Very good blog you have here but I wass wanting to know if you knew of any forums that cover the same topics discussed inn thhis article? I'd really love to be a part of group where I can get comments from other knowledgeable individuals that share the same interest. If you have any suggestions, please let me know. Cheers!

Posted by: Hostgator Coupons | 2015.01.18 at 05:41 AM

magnificent submit, very informative. I'm wondering why thee opposite experts of this sector don't understand this. You must continue your writing. I am confident, you have a huge readers' base already!

Posted by: Hostgator Coupons | 2015.01.18 at 05:58 AM

Some research have proven that some slimming capsules work, but the issue is, the danger of health problems that go along with Coronary heart related problems have shot by the roof, and plenty of deaths have been attributable to these capsules. It is best to be seen by your doctor first to see what the dangers are in taking any of these pills. There is a flood of these pills available on the market as of late, and there are three different types. Fat burners do work but you'll want to be careful.

Posted by: best weight loss pills uk | 2015.01.23 at 02:21 PM

Having read this I thought it was rather informative. I appreciate you spending some time and energy to put this content together. I once again find myself personally spending a lot of time both reading and commenting. But so what, it was still worth it!

Posted by: Dieta odchudzajaca | 2015.01.24 at 05:08 AM

Today, I went to the beach front with my kids. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is completely off topic but I had to tell someone!

Posted by: candy Crush Soda Saga | 2015.01.26 at 02:16 PM

Every weekend i used to visit this web page, as i want enjoyment, for the reason that this this web page conations genuinely good funny data too.

Posted by: Candy Crush Soda Saga | 2015.01.27 at 12:21 AM

This is very fascinating, You are an overly professional blogger. I have joined your feed and stay up for searching for more of your excellent post. Additionally, I have shared your website in my social networks

Posted by: Candy Crush Soda Saga | 2015.01.27 at 12:31 AM

Someone essentially help to make critically posts I'd state. This is the first time I frequented your web page and so far? I amazed with the research you made to create this particular post amazing. Wonderful job!

Posted by: Candy Crush Soda Saga Hack | 2015.01.27 at 02:21 AM

This is my first time visit at here and i am genuinely impressed to read all at single place.

Posted by: Candy Crush Soda Saga | 2015.01.27 at 04:15 AM

Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but other than that, this is wonderful blog. A great read. I'll definitely be back.

Posted by: Candy Crush Soda Saga | 2015.01.27 at 06:16 AM

Saved as a favorite, I really like your web site!

Posted by: Candy Crush Soda Saga | 2015.01.27 at 09:09 AM

We're a group of volunteers and starting a new scheme in our community. Your site offered us with valuable info to work on. You have performed an impressive activity and our entire group shall be grateful to you.

Posted by: Candy Crush Soda Saga | 2015.01.27 at 11:05 AM

Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something informative to read?

Posted by: Candy Crush Soda Saga Hack | 2015.01.27 at 12:55 PM

This post offers clear idea for the new viewers of blogging, that truly how to do blogging and site-building.

Posted by: Candy Crush Soda Saga | 2015.01.27 at 03:09 PM

I used to be able to find good info from your articles.

Posted by: Candy Crush Soda Saga | 2015.01.27 at 10:31 PM

I'm curious to find out what blog system you're utilizing? I'm experiencing some minor security issues with my latest site and I'd like to find something more safeguarded. Do you have any suggestions?

Posted by: clash of clans triche | 2015.01.28 at 04:46 PM

Hey just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Safari. I'm not sure if this is a formatting issue or something to do with browser compatibility but I thought I'd post to let you know. The design look great though! Hope you get the issue fixed soon. Thanks

Posted by: Payday App | 2015.01.29 at 01:53 AM

I have been surfing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all website owners and bloggers made good content as you did, the web will be a lot more useful than ever before.

Posted by: Hay Day Hack Tool | 2015.01.29 at 07:24 AM

Hi there! This post couldn't be written any better! Reading this post reminds me of my previous room mate! He always kept chatting about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!

Posted by: landscape architecture | 2015.01.29 at 03:14 PM

I used to be recommended this web site via my cousin. I am not certain whether this submit is written through him as no one else recognize such exact approximately my problem. You're amazing! Thank you!

Posted by: income tax accountant | 2015.01.30 at 01:45 AM

I enjoy, cause I discovered exactly what I used to be having a look for. You have ended my 4 day long hunt! God Bless you man. Have a great day. Bye

Posted by: Divergente film Complet | 2015.01.30 at 09:42 AM

Combine the ex girlfriend with a narrow minded religious friend of the family and your money should be quite safe especially if you provide that the trustees' decisions are to be unanimous. Feelings get hurt and bitterness creeps in, almost unnoticed. In many cases it is being added to their treatment plans. As you can guess from its name, this liver disorder is not caused by excess alcohol consumption, although it's not uncommon for alcohol drinkers to experience this disease. This projection is hardly ever recognized by the 'victim' who is likely to be taken by surprise.

Posted by: http://ragingalcoholic.com/stages-alcoholism/ | 2015.01.30 at 04:40 PM

Hi it's me, I am also visiting this website daily, this web page is truly fastidious and the viewers are genuinely sharing nice thoughts.

Posted by: treatment for eczema | 2015.01.31 at 03:09 AM

I read this piece of writing completely concerning the resemblance of most up-to-date and previous technologies, it's amazing article.

Posted by: thenorthparkresidence.net northpark residences price | 2015.02.01 at 03:10 PM

When you're eating whole foods instead of ding dongs out of a box, you're going to be getting a lot more nutrition in your food. Disc Playback Modes: A-B Repeat, Angle, PBC, Slow Motion, Zoom, Disc Menu, Fast Backward, Fast Forward, OSD, Parental control, Resume Playback from Stop. It has been designed so compactly and carrying very small working units so that it can be kept anywhere taking a less kitchen space.

Posted by: oster food processor | 2015.02.01 at 07:51 PM

Thanks for finally writing about >PEAR::Services_Lingrで日本語を扱うときの注意: TEDDY-G本家

Posted by: removals france | 2015.02.02 at 02:48 PM

You can make a living with megaranker dot com

Posted by: check offers | 2015.02.03 at 09:32 AM

But apps like this require a certain scale to make sense. But i - Phone game development came to my rescue, and today I am one of the best fighters on i - Phone. Push Notifications, like Text messages, are sent through your app, to those who have downloaded it, and appear as a text message on their phone. The only real advantage for this option is that there are no upfront costs. Thanks in large part to all of the information that is available on the internet, more and more Americans are looking for ways that they can take greater control over their own lives instead of having to rely on large corporations so much.

Posted by: Unlock | 2015.02.05 at 11:11 AM

Wow that was unusual. I just wrote an very long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Anyway, just wanted to say excellent blog!

Posted by: Summoners War Com2Us Hack | 2015.02.06 at 11:34 AM

I would like to thank you for the efforts you have put in penning this site. I am hoping to see the same high-grade blog posts by you later on as well. In fact, your creative writing abilities has encouraged me to get my own, personal blog now ;)

Posted by: clash of clans triche | 2015.02.09 at 06:38 PM

Hi, I do believe this is an excellent website. I stumbledupon it ;) I will revisit yet again since I book marked it. Money and freedom is the greatest way to change, may you be rich and continue to help others.

Posted by: sara schwartz gluck | 2015.02.10 at 04:26 PM

Hi there! Someone in my Myspace group shared this website with us so I came to look it over. I'm definitely loving the information. I'm bookmarking and will be tweeting this to my followers! Wonderful blog and great style and design.

Posted by: Just Shout ipad hack | 2015.02.11 at 04:01 PM

I am extremely impressed along with your writing skills as well as with the structure to your blog. Is this a paid subject matter or did you customize it your self? Either way keep up the excellent quality writing, it is uncommon to look a great weblog like this one nowadays..

Posted by: smash champs cheats | 2015.02.11 at 06:45 PM

Some very nice stuff on this website, I like it.

Posted by: Mel | 2015.02.12 at 02:00 AM

Everyone loves what you guys tend to be up too. Such clever work and reporting! Keep up the terrific works guys I've incorporated you guys to our blogroll.

Posted by: how does bankruptcy work | 2015.02.12 at 10:43 PM

Since it is a fairly new idea to local business owners, there aree some services out there that just white label other people's services and brand them as their own and charge an arrm and a leg for building mobile websites. The most popular of these niches are restaurant guides. If yyou need someone to manage your campaigns call me at 863-698-8266 and I will be glad to help you get started.

Posted by: best ways to make money online from home | 2015.02.14 at 12:35 AM

Another thing needed to be donme as a parent is to set rules for online games. Dish out revenge on the greedy green pigs wwho stole the their eggs. I compared the pice with the local store, it is $30 dollars cheaper.

Posted by: strategiespiele online | 2015.02.14 at 07:39 PM

You can use Listmania, person evaluations and general browsing on the site to get information regarding products that are similar to Alli which may interest you and be something that you need to try. If you are using these pills you also need not to exercise as these pills automatically reduces the fats cells in the body. The people of China and Japan have a well documented history of being healthy and using many different methods to ensure that they live healthful and long lives.

Posted by: grenade thermo detonator | 2015.02.17 at 09:46 PM

Great post.

Posted by: this content | 2015.02.17 at 10:51 PM

Way cool! Some very valid points! I appreciate you writing this article plus the rest of the site is also really good.

Posted by: look what i found | 2015.02.17 at 11:45 PM

2004. IGF1 Serious Factor Matrix Deer.

Posted by: Robyn | 2015.02.17 at 11:56 PM

Thanks for sharing such a pleasant thinking, piece of writing is pleasant, thats why i have read it entirely

Posted by: guitar tricks coupon code | 2015.02.18 at 06:17 AM

I am really enjoying the theme/design of your web site. Do you ever run into any internet browser compatibility issues? A handful of my blog audience have complained about my website not operating correctly in Explorer but looks great in Opera. Do you have any advice to help fix this issue?

Posted by: fatheads | 2015.02.18 at 07:36 AM

I really like looking through an article that can make men and women think. Also, many thanks for permitting me to comment!

Posted by: cheap contact lenses online | 2015.02.18 at 10:06 AM

However, when there is an electrical emergency, there is not much time to take care of so many aspects. Whether it's indoor or external lighting, sockets and switches, home network or security systems, fire alarms or burglar alarms there is an electrician in Watford ready to come to your aid. Orange County Animal Services would like you to know they have qualified for the highly competitive ASPCA $100K Challenge.

Posted by: electric electricianEmergency Electricians | 2015.02.18 at 06:49 PM

So which would you choose as your favorite Pokemon character. Easy way to get this targets with educational terms that provides them the particular coloring substance that sparks the creative imagination of young people. Only then, your friends would get impressed by you.

Posted by: http://www.autosparesbenoni.co.za/ | 2015.02.18 at 07:33 PM

Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! By the way, how can we communicate?

Posted by: discount contact lenses | 2015.02.22 at 11:11 PM

fantastic points altogether, you simply received a emblem new reader. What could you recommend about your put up that you made some days ago? Any positive?

Posted by: power of the subconscious mind | 2015.02.23 at 12:38 PM

Thanks for finally talking about >PEAR::Services_Lingrで日本語を扱うときの注意: TEDDY-G本家

Posted by: outdoor products duffle bag | 2015.02.23 at 04:12 PM

If you want to take much from this article then you have to apply these techniques to your won blog.

Posted by: aura music and arts festival | 2015.02.23 at 04:39 PM

By reinforcing the new, healthy behaviors until they become lifestyle, the porn addiction no longer serves the person like it used to. ve discussed how destructive and widespread porn is in our culture; my son knows he will be exposed to it, and that hiding his temptations or trying to fight them on his own will give lust the power to rule his life. t stop watching porn movies in hotel rooms, he must leave the TV off, doesn. The CBC estimated in 2009 that at any given moment in time, a total of 20 million computers are being infected with as many as one billion viruses that are related to child porn sites. With the two women in his life impressing John with their outlooks-one a bi-polar mother, the other a prim and proper aunt (with an exceptionally good job by Kristin Scott Thomas)-we see that "Nowhere Boy" is not so much a look at the early days of a rock-and-roll star but the struggle of a renegade toward maturity.

Posted by: oral | 2015.02.28 at 05:36 AM

Block Porn Websites and Keep your computer clean and safe. Feeling lonely is not an indication that there is something wrong with you. It creates all types of damaging emotions all fashioned to drive us back to the previous behavior. Eddie and Jamie corner the Santiago son in his high school hallway, relating the evidence. Consequently, expect that you'll find just too many decisions and selections online.

Posted by: ejaculation | 2015.03.03 at 03:40 AM

Please let me know if you're looking for a author for your site. You have some really good articles and I think I would be a good asset. If you ever want to take some of the load off, I'd love to write some content for your blog in exchange for a link back to mine. Please send me an email if interested. Thanks!

Posted by: www.hanswurst.de | 2015.03.03 at 06:37 PM

Post a comment



(Not displayed with comment.)




TrackBack

TrackBack URL for this entry:
http://app.cocolog-nifty.com/t/trackback/20589/15667717

Listed below are links to weblogs that reference PEAR::Services_Lingrで日本語を扱うときの注意:

« 今見ているページにGoogle Mapsを追加するBookmarklet | Main | SanDisk CruzerMicro 4GB »