Using Emoji in Web Apps

Using Emoji in Web Apps

By Cal Henderson, October 21st 2009.

iPhone Screenshot

If you haven't been locked in a small box for the past year, then you'll be familiar with the screenshot on the left - the Emoji keyboard on the iPhone. If you haven't unlocked yours yet, just go into the app store and search for 'emoji' to find an app.

Emoji is the Japanese term for small emoticon pictures. The word 'e moji' literally means 'picture letter'. They've seen widespread adoption in the Japanese mobile market, with multiple providers adding the ability to send these pictograms as part of text messages, emails and on web pages.

This is achieved via the Unicode Private Use character space, a large set of code points where vendors can define their own meanings. This is all well and good, but of course nobody agrees on what code points should mean which pictures.

The players in the space for the most part were NTT DoCoMo, KDDI/Au and Softbank/Vodafone. More recently, Apple have added emoji support to the iPhone and Google to the Android mobile operating system. While Apple chose to use the Softbank/Vodafone mappings, all of the others are distinct, creating four different standards.

Using Emoji

Exchanging little pictures in SMS is pretty fun for while, but why should that fun be limited to SMS? If we're building web apps which receive data from mobile devices or display data on them, we should be able to leverage these little critters. We can even create them ourselves as iconography without the cost of creating and serving image files.

But this isn't trivial - different devices use different code points (an iPhone can't display a smiley face entered on an Android phone) and people will be using your web app with a regular desktop browser too. Luckily, there's a reasonable solution to all these problems.

The Unified Set

There's a Unicode proposal from folks at Google and Apple to standardize emoji down to a single set of code points. While these code points haven't yet been formalized, this proposal contains a way to map each of the four different schemes. By using this unified mapping internally within our application, we can convert from any input scheme to any other output scheme.

At input time, we need to know where the data has come from, since some of the different sets overlap - both Softbank's 'frog face' and KDDI's 'small white square' are represented by U+E531. If we convert from the native encoding to the unified encoding for storage, we don't need to store the format. At output time, we can detect which platform we're delivering content to and convert from the unified set to the platform specific set.

Not all of the platform's emoji sets are equal though, so some symbols appear in only one set, or appear multiple times. For instance, KDDI has an emoji called 'large white square' with a code point of U+E548. DoCoMo doesn't have any equivalent at all, while Softbank has U+E21B meaning 'white rounded square' which can be used in its place. The proposal includes one-way mappings for some missing characters and replacement text for others - while all emoji are not supported by all platforms, there is a recommended replacement for them.

Back to the desktop

This is all well and good, but what should we do if someone enters emoji on their device which we want to display to non-mobile users? The unified set are Unicode code points which are defined by some fonts, but the pictures will be monotone and are missing from most common web fonts.

With a smart bit of output-processing, we can replace characters from the unified set with HTML to show inline images. At display time, our code can search for instances of the UTF-8 byte sequence 0xE2 0x98 0xBA (known to friends as U+263A, the smiley face) and replace them with <img src="/emoji/smiley_face.gif" class="emoji" />, or whatever HTML we wish to use.

Speed Concerns

The unified set is pretty big, covering 772 characters. Performing a search and replace at display time is going to take a couple of milliseconds, so for heavily trafficked applications, we might need to start worrying about performance. Luckily there are a few tricks.

Assuming most of your content doesn't contain emoji, you can add an extra field to your database rows calledcontains_emoji. By setting this at insert time, you can only spend time transcoding the emoji at output time if there are actually any in there.

If your application has lots and lots of emoji content, then storing multiple versions of your content with different emoji formats in might make sense. If you know you're primarily serving to DoCoMo users, then store both a unified and a DoCoMo copy. When you need to serve to DoCoMo, use that version, else convert from the unified version.

A library to make it all happen

I've put together a simple PHP library to abstract all of the messiness away. Just include it in your application and start detecting emoji right away. Instructions are included in the readme file.

Post-Script

While I'm a bit of a Unicode nerd, I'm no expert. The above article may contain mistakes or fail to mention very important things. If you spot any glaring mistakes or omissions, drop me an email and teach me: cal [at] iamcal.com

Copyright © 2009 Cal Henderson.

The text of this article is all rights reserved. No part of these publications shall be reproduced, stored in a retrieval system, or transmitted by any means - electronic, mechanical, photocopying, recording or otherwise - without written permission from the publisher, except for the inclusion of brief quotations in a review or academic work.

All source code in this article is licensed under the GPL v3.

 

 

原文链接地址:http://www.iamcal.com/emoji-in-web-apps/

Windows Server部署DataX与DataX-Web全攻略:避坑指南与实战 数据同步是构建数据仓库和数据分析平台的基础环节,其核心原理是通过抽取、转换、加载(ETL)过程,实现异构数据源间的数据流动。开源工具DataX以其插件化架构和丰富的读写插件,成为解决这一需求的流行选择,而DataX-Web则提供了可视化的任务管理与调度界面,极大提升了运维效率。在工程实践中,Linux环境是主流部署平台,但部分企业因历史原因或特定需求,仍需在Windows Server上部署此类工具链。本文将聚焦于Windows Server 2019环境,详细解析部署DataX 3.0与DataX-Web 阅读详情

相关推荐

2025-08-19利用opencv检测图片中文字及图片的坐标

该代码实现了图片中中文文本的检测与位置计算功能。主要使用CnOcr库进行OCR识别,结合OpenCV和PIL库处理图像。功能包括:1)检测图片中的中文文本及位置坐标;2)计算每个文本的像素宽度和高度;3)在原图上绘制文本边界框并标注识别结果。代码通过put_chinese_text函数解决中文显示问题,最终输出各文本内容、坐标位置及尺寸信息。适用于需要获取图片中文字精确位置的应用场景。

m0_58149406的博客 395

如何在网页上看到emoji_如何在Ubuntu上卸载Emoji

如何在网页上看到emojiUbuntu 18.04 LTS features a new set of shiny color emoji. If you don’t want to see emoji in messaging apps, on the web, and elsewhere, you can remove them from your system. Ubuntu 18.04 L...

cum88284的博客 391

FISCO-BCOS配置及使用控制台

如果因为网络问题长时间无法下载,请尝试:curl -#LO https://gitee.com/FISCO-BCOS/console/raw/master-2.0/tools/download_console.sh && bash download_console.sh。为了可以更加方便快捷,所以HelloWorld合约已经被内置了,位于控制台下面的contracts/solidity/HelloWorld.sol。用于获取和设置name的值,合约代码如下。部署成功会返回合约地址。

qq_51562644的博客 831

php-emoji使用详解

地址:https://github.com/iamcal/php-emoji php-emoji - Process Emoji in PHP This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them u

u013216667的博客 2810

ROS2学习笔记(二)-- 多机通讯原理简介及配置方法

简单介绍ROS2多机通信原理以及配置注意事项

aibingjin的博客 1万+

Windows 11最新WDK安装避坑指南:从Visual Studio配置到KMDF驱动开发

本文提供了在Windows 11系统上进行KMDF驱动开发的完整环境搭建与实战指南。针对最新WDK与Visual Studio的配置变化,详细解析了从独立安装WDK/SDK、创建首个KMDF驱动项目,到编译排错、部署调试的全流程,帮助开发者高效避坑,顺利开启Windows内核开发。

weixin_29302047的博客 527

获取emoji网页的内容保存到本地

var http = require('http'); var fs = require('fs'); var cheerio = require('cheerio'); var readof = require('readof'); var url = "http://apps.timwhitlock.info/emoji/tables/unicode#block-4-enclo

Keep It Simple, Stupid 2435

海康H304NAS 刷机飞牛

本文旨在分享如何将闲置的海康威视H304 NAS刷入飞牛NAS系统,并利用iStoreOS作为安装媒介。之前因为使用极空间NAS,这台H304闲置已久。最近尝试了飞牛NAS,在虚拟机上安装后挂载极空间的电影资源,体验不错,于是决定重新折腾这台H304。我个人喜欢尝试新系统,之前经常更新H304的固件,但设备总在使用一两年后出现故障,需要联系技术清理日志才能恢复。最后一次设备“变砖”后,连技术人员也联系不上了,自己尝试修复未果,设备就此闲置两三年。

u012985257的博客 2747

适合在Markdown里面使用的emoji

因为Markdown里面加颜色需要写html style, 所以对于一些标题, 还是用一下emoji吧: RED APPLE (&#x1F34E;): GREEN APPLE (&#x1F34F;): BLUE HEART (&#x1F499;): GREEN HEART (&#x1F49A;): YELLOW ...

weixin_33938733的博客 272

osgEarth加载大疆数据

【代码】osgEarth加载大疆数据。

weixin_44769745的博客 308

【Envi风暴】Envi5.6安装图文教程(附Envi5.6完整版下载)

【Envi风暴】Envi5.6与应用商店app store安装图文教程(附Envi5.6完整版下载)从文末网盘下载完整的ENVI5.6安装包,如下所示:双击envi56-win.exe,开始安装。将f__x64下的两个补丁文件拷贝到安装路径。将f__x86下的两个补丁文件拷贝到安装路径。

智慧空间实验室 9204

Unicode表情对照表

Unicode表情对照表

千里之行,始于足下 3396

【制作100个unity游戏之22】3DRPG游戏开发01——项目的设置和导入及渲染管线的安装修复

如果你现在存在一些疑惑unity导入素材为什么是粉紫色的?表示他没有适配我们的URP通用渲染管线,要如何适配呢?素材渲染错误丢失要如何解决?如果你有上面3个任意的问题,那这篇文章同样适合你,我将手把手教你如何安装修复渲染管线,看完你就了解了!在Unity中,他们都是渲染管线,它们的主要区别在于性能和功能。LWRP是早期版本的URP,它专门为移动设备和低端PC设计,旨在提供更高的性能。它使用基于顶点的光照和简化的后处理效果,可以在更低的硬件要求下运行。

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 2429

app表情符保存到数据库的问题

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33720452的博客 193

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Uvicorn与Django集成:异步Web应用开发的完整指南

Uvicorn是一个基于ASGI协议的Python Web服务器,能够为Django等Web框架提供高性能的异步支持。本指南将详细介绍如何将Uvicorn与Django框架无缝集成,帮助开发者构建高效的异步Web应用。 [![Uvicorn标志](https://raw.gitcode.com/GitHub_Trending/uv/uvicorn/raw/02bed6f8c38e74f684bb

gitblog_00400的博客 668

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

探索现代Web的秘密武器:Service Worker Detector

探索现代Web的秘密武器:Service Worker Detector 在快速发展的互联网世界中,前端开发者正不断寻找提高网页性能和离线支持的新途径。而Service Worker,作为一项强大的Web API,正是这样的解决方案之一。今天,我们向您推荐一个能帮助您检测并理解网站Service Worker使用情况的开源项目——Service Worker Detector。 1、项目介绍 Se...

gitblog_00013的博客 524

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

如何快速上手myMonero App JS:打造你的终极Monero钱包应用

myMonero App JS是一个强大的Monero钱包应用库,专为开发者构建安全、高效的Monero桌面应用而设计。无论是新手还是有经验的开发者,都能通过这个开源项目轻松实现Monero钱包的核心功能,包括交易管理、地址生成和安全存储等。 ## 🚀 项目概览:什么是myMonero App JS? myMonero App JS是GitHub加速计划中的一个重要项目,其源码路径为`gh_

gitblog_00062的博客 295

Android “奥利奥”终于出炉,吃了它你的手机将获得超能力!

本文讲的是Android “奥利奥”终于出炉,吃了它你的手机将获得超能力,在数月公开测试之后,Android 8.0 “O” 终于发布了。正式名称(毫无疑问)又是一款畅销全球的零食:奥利奥 Oreo。 Google 认为,Android Oreo 能让你的手机获得超能力:更快、更强、更智能。当然,也更省电、更安全。 为什么你应该关注 Android...

weixin_34301307的博客 213

Android福利来了,很快Android手机能吃上「奥利奥」了

Google今天正式发布了Android8.0,Android 8.0系统正式命名为“Oreo”,它就叫 Android Oreo(奥利奥)。 那么它带了哪些变化了? 首先,新版移动系统给人最直观的感受就是比前代更快,启动速度最高可以快两倍,能够节省更多的电量,此外更卓越的后台活动管理带来更流畅更灵敏的反馈。 其次,支持自动填充功能,自然这需要得到用户的许

zbryant的博客 714

修改时序约束改变slack_如何更改Slack的默认表情符号肤色

修改时序约束改变slackUnless you’re a character from The Simpsons, Slack’s default yellow skin tone for emojis probably doesn’t represent you. Fortunately, there’s an easy way to change the default emoji skin ...

culiyuan8310的博客 566

wordpress添加媒体_如何向您的WordPress博客添加表情符号支持

wordpress添加媒体Emojis are fun and cute. They allow you to express yourself without using too many words. This is why they’re so popular on social media sites and texting apps. Many WordPress users are l...

cumohuo9136的博客 484

Django Admin 启用三步法:从404到生产级后台的完整配置指南

Django Admin 是一个基于类、可插拔的后台管理框架,其核心原理是显式启用(enable)与显式连接(connect)的双重控制机制。它并非开箱即用,而是依赖 INSTALLED_APPS 注册、URL 路由注入和用户认证体系三重协同,技术价值在于默认关闭带来的防御性安全设计。典型应用场景包括快速构建内部数据管理界面、运营后台、内容审核系统等。本文聚焦 Django 和 Admin Interface 两大关键热词,系统梳理从路由配置、超级用户创建到模型注册的全流程实践,覆盖开发调试与生产加固。

weixin_30247307的博客 341

用于Android开发的免费类库和工具集合

用于Android开发的免费类库和工具集合,按目录分类。 Action Bars ActionBarSherlockExtended ActionBarFadingActionBarGlassActionBarv7 appcompat library 广告 AdMobGoogle Mobile Ads SDKInMobimMediamobileCoreMoPub

技术积累、分享成果 2885

Electron-为21世纪打造的文本编辑器的基础

Electron-为21世纪打造的文本编辑器的基础flyfish 2015-11-21题目的产生 Github的atom和微软Visual Studio Code这两款开源的编辑器是利用Electron开发的,atom对外宣传有个for the 21st Century 所以文本的题目由此产生。 Note: Electron was previously named Atom Shell.

二分掌柜的 5483

unicode箭头总汇_如何使用Unicode创建项目符号,商标,箭头等

unicode箭头总汇Unicode is an encoding standard for ensuring the consistent handling of text by computers and other devices. The full Unicode collection spans more than 110,000 characters, but aside from t...

culi3182的博客 1280

Android开发免费类库和工具集合

用于Android开发的免费类库和工具集合,按目录分类。 Action Bars ActionBarSherlockExtended ActionBarFadingActionBarGlassActionBarv7 appcompat library 广告 AdMobGoogle Mobile Ads SDKInMobimMediamobileCor

Go贝壳 2738
上一篇: Emoji for PHP
下一篇: ios 状态栏隐藏
firepix
博客等级 码龄15年 1粉丝 95原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值