[Powershell] Convert Chinese character to pinying

Found a new job in Beijing, the company was using cloud stuff for infrastructure IT systems, like mail system, mobile messaging, IM. The company is going bigger and stronger, making more money, so the bosses decided update to AD/exchange/lync. It is quite hard to manage compare to a pure foreign enterprise cause Chinese prefer see Chinese characters when doing jobs. Like mix Chinese characters and pinyings togerther, or first letters from Chinese characters. To me, this could be a big problem potentially, so I would like to figure out a way to convert Chinese characters to pinyings.

There actually already many websites provide such service, probably I can simply invoke those webservices as API, but I prefer ways more offically instead of webservices over internet.

Fortunately, Microsoft already provided a DLL for this kind purpose, downloading from:

http://www.microsoft.com/en-us/download/details.aspx?id=15251

Details usage we can know from help document after installation, it really straightforward, like

Simplified Chinese Pin-Yin Conversion Library Document.chm

Under

C:\Program Files (x86)\Microsoft Visual Studio International Pack\Simplified Chinese Pin-Yin Conversion Library

For powershell, the only need is ChnCharInfo.dll, I can copy it to wherever I like,

Then, how I import the DLL?

Another way more fancy is using [Reflection.Assembly]::LoadFile

After we loaded it into powershell runspace, we can invoke its class, class name can be known from chm file we mentioned just now.

The library only owns one namespace and one class, what a simple class makes like easier.

Below example reveals the way to convert a Chinese character to pinying.

The number following the pinying is 5 different tones when Chinese pronouncing.

时间: 2024-08-23 21:02:39

[Powershell] Convert Chinese character to pinying的相关文章

IEF could not decode Chinese character in IE history well

My friend is working on some case, and she looks not in the mood. I ask her what's going on. She wants me to look at the screenshot as below. That's why she is upset...IEF could not decode Chinese character in IE history well, so the filenames in Chi

EnCase v7 could not recognize Chinese character folder names / file names on Linux Platform

Last week my friend brought me an evidence file duplicated from a Linux server, which distribution is CentOS 5.0 and the i18n is zh-tw. She wanna know whether there is any malware on this Linux server or not. OK. Let's get to work. I add this evidenc

csharp: Converting chinese character to Unicode

Function chinese2unicode(Str) Dim Str_one:Str_one = "" Dim Str_unicode:Str_unicode = "" For i = 1 To Len(Str) Str_one = Mid(Str, i, 1) If AscW(Str_one) < 0 or AscW(Str_one) > 255 Then Str_unicode = Str_unicode & Chr(38) Str_u

How to show Chinese character by using Perl?

You need to usemodule:  Unicode::Map Where to get it? -http://search.cpan.org/~mschwartz/Unicode-Map-0.112/Map.pm Download Unicode-Map-0.112.tar.gz How to install it? -unzip the file andgo the folder: C:\Users\rebecca\Desktop\Temp\Unicode-Map-0.112>p

汉字转拼音再转ASCII

汉字可以转成拼音,可以在转成ASCII码,然后就可以转成十六进制数,再就可以转成0和1组成的二进制帧了! 比如说: 我爱你 -> wo ai ni -> 119 111 32 97 105 32 110 105 ->77 6F 20 61 69 20 6E 69 ->0111 0111 0110 1111 0010 0000 0110 0001 0110 1001 0010 0000  0110 1110 0110 1001 看上去很吊的样子,估计发报就是这么干的! package

Android汉字转拼音HanziToPinyin

Android系统本身自带有有将汉字转化为英文拼音的类和方法.具体的类就是HanziToPinyin.java.Android系统自身实现的通讯录中就使用了HanziToPinyin.java对中文通讯录做分组整理.通过HanziToPinyin.java可以将汉字转化为拼音输出,在一些应用中非常必须,比如联系人的分组,假设一个人通讯录中存有若干姓张(ZHANG)的联系人,那么所有姓张的联系人按理都应该分组在"Z"组下.又比如微信.QQ等等此类社交类APP,凡是涉及到联系人.好友分组排

Android 汉字转拼音之工具篇

/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://w

wesome-android

awesome-android Introduction android libs from github System requirements Android Notice If the lib is no longer being maintained,please do not add it here. How To Contribute Step 1. Add a Item as follows: **Library Name**[one space]Short Description

Android 汉语转拼音

有很多时候我们需要将汉字转换为拼音,例如手机中的联系人排序.在12306买车票时输入SZ\shenzhen就会提示深圳. Android提供了汉字转拼音的类HanziToPinyin.java,据说这个类是在联系人app下的.具体目录是packages/providers/ContactsProvider /src/com/android/providers/contacts的HanziToPinyin.java文件. 不过俺是新手没有找到这个类,不过网上有不少大神都把源码贴出来了,我也借鉴一下