解决读取iphone名称中文乱码问题
#region 解决中文乱码 Ethan 2016-01-06
[DllImport("iTunesMobileDevice.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "AMDeviceCopyValue")]
public unsafe static extern __CFString* AMDeviceCopyValue_1(void* device, uint unknown, void* cfstring);
[DllImport("CoreFoundation.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern int CFStringGetLength(__CFString* thisString);
// Token: 0x060000A3 RID: 163
[DllImport("CoreFoundation.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern byte CFStringGetCString(__CFString* thisString, void* value, int length, uint format); // Token: 0x060000D5 RID: 213 //for 32位
[DllImport("msvcr71.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern void* malloc(uint size); // Token: 0x060000D7 RID: 215 //for 64位
[DllImport("msvcr100.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "malloc")]
public unsafe static extern void* malloc_64(ulong size); // Token: 0x02000012 RID: 18
public struct __CFString
{
} public unsafe static string AMDeviceCopyValue_fix(void* device, string name)
{
string result = "";
try
{
__CFString* ptr = AMDeviceCopyValue_1(device, 0u, __CFStringMakeConstantString(StringToCString(name)));
if (ptr != null)
{
uint num = (uint)CFStringGetLength(ptr);
uint num2 = 4u * num + 2u;
sbyte* value; try
{
value = (sbyte*)malloc(num2);
}
catch (Exception)
{ value = (sbyte*)malloc_64(num2);
} CFStringGetCString(ptr, (void*)value, (int)num2, 134217984u);
EX.UTF8Marshaler uTF8Marshaler = new EX.UTF8Marshaler();
result = (string)uTF8Marshaler.MarshalNativeToManaged(new IntPtr((void*)value)); }
}
catch (Exception ex)
{ } return result;
}
#endregion
解决读取iphone名称中文乱码问题的更多相关文章
- Python读取 csv文件中文乱码处理
需求:按行解析读取csv文件存入关系型数据库——主要是中文字体解析:遇到的问题:直接解析出来的数据为list形式,而且编码格式为unicode;解决问题:前提了解: 中文编码的规则 —— GB2312 ...
- asp.net core mvc 读取appsettings.config中文乱码问题
asp.net core mvc 读取appsettings.config中文乱码问题的解决方法如下: 用记事本打开appsettings.config,另存为的时候,编码设置为 “UTF-8”,
- 解决 SecureCRT 和 SecureFX 中文乱码
引言 最近老是有小伙伴给我发消息说,下载的 SecureCRT 和 SecureFX 安装打开后连接了自己的服务器或虚拟机后会出现中文乱码,每次都要给一一回复,我倒没事,主要是有时候因为工作的原因,所 ...
- SpringMVC学习系列-后记 解决GET请求时中文乱码的问题
SpringMVC学习系列-后记 解决GET请求时中文乱码的问题 之前项目中的web.xml中的编码设置: <filter> <filter-name>CharacterEnc ...
- 解決BufferedReader读取UTF-8文件中文乱码
解決BufferedReader读取UTF-8文件中文乱码 File rst01 = new File(context.getRealPath("/")+" ...
- 解决gitk显示文件内容中文乱码
解决gitk显示文件内容中文乱码 1.git config 命令 设置git gui的界面编码 git config --global gui.encoding utf-8 2.修改配置文件 在~\e ...
- 解决PLSQL Developer 插入中文 乱码问题(转)
原文地址:解决PLSQL Developer 插入中文 乱码问题 PLSQL Developer 插入中文 乱码问题,如图 这个是由于oracle服务器端字符编码 和 Oracle 客户端 字 ...
- 解决windows下vim中文乱码
解决windows下vim中文乱码 windows安装了vim8,也就是gvim后,打开带有中文的文档,显示中文是乱码. 毕竟有许多文档我是用utf-8编码的,所以解决的办法是设置一下编码为utf-8 ...
- tomcat7解决jsp参数传递的中文乱码问题
解决jsp参数传递的中文乱码问题 制作人:全心全意 在jsp页面中,通过参数传递传递中文时,在显示参数值时中文内容变成了乱码.这是因为请求参数的文字编码方式与页面中的不一致造成的,所有的request ...
随机推荐
- javase-常用三种遍历方法
javase-常用三种遍历方法 import java.util.ArrayList; import java.util.Iterator; import java.util.List; public ...
- CSS--实现小三角形
<style> html, body { margin: 0; padding: 0; } /*下面用CSS3分别实现向上.下.左.右的三角形*/ .btn-color{ color: # ...
- H5(三)
Canvas(画布) 基本内容 简单来说,HTML5提供的新元素<canvas> Canvas在HTML页面提供画布的功能 在画布中绘制各种图形 C ...
- 关于安装CentOS 7 的注意事项
1.安装VMware Workstation 2.安装CentOS的时候选择GNOME桌面 3.联网设置, VMWare Network Apapter VMnet8 设置IP4 自动获取IP地址,“ ...
- Java 之 软件的生命周期
1.寻找商机: a.项目:有明确的需求提供方 b.产品:没有需求提供方,由市场决定 2.可行性分析: a.国家法律法规 b.资金 c.人员技术组成 3.投标 4.需求的搜集与分析: a.参与人员:需求 ...
- linux命令二
4. df -h 查看磁盘使用情况 cpu: user,system,idle,iowait mem: total,used,free,cached,buffe ...
- [leetcode]题型整理之用bit统计个数
137. Single Number II Given an array of integers, every element appears three times except for one. ...
- Git - 问题集
1.If no other git process is currently running, this probably means a git process crashed in this re ...
- Double的精度问题
/** * 自定义Math工具类 * */ public class MyMathTools { /** * 提供精确的小数位四舍五入处理. * * @param v * 需要四舍五入的数字 * @p ...
- Web前端工程师成长之路——知识汇总
一.何为Web前端工程师? 前端工程师,也叫Web前端开发工程师.他是随着web发展,细分出来的行业.Web前端开发工程师,主要职责是利用(X)HTML/CSS/JavaScript ...