#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名称中文乱码问题的更多相关文章

  1. Python读取 csv文件中文乱码处理

    需求:按行解析读取csv文件存入关系型数据库——主要是中文字体解析:遇到的问题:直接解析出来的数据为list形式,而且编码格式为unicode;解决问题:前提了解: 中文编码的规则 —— GB2312 ...

  2. asp.net core mvc 读取appsettings.config中文乱码问题

    asp.net core mvc 读取appsettings.config中文乱码问题的解决方法如下: 用记事本打开appsettings.config,另存为的时候,编码设置为 “UTF-8”,

  3. 解决 SecureCRT 和 SecureFX 中文乱码

    引言 最近老是有小伙伴给我发消息说,下载的 SecureCRT 和 SecureFX 安装打开后连接了自己的服务器或虚拟机后会出现中文乱码,每次都要给一一回复,我倒没事,主要是有时候因为工作的原因,所 ...

  4. SpringMVC学习系列-后记 解决GET请求时中文乱码的问题

    SpringMVC学习系列-后记 解决GET请求时中文乱码的问题 之前项目中的web.xml中的编码设置: <filter> <filter-name>CharacterEnc ...

  5. 解決BufferedReader读取UTF-8文件中文乱码

    解決BufferedReader读取UTF-8文件中文乱码         File rst01 = new File(context.getRealPath("/")+" ...

  6. 解决gitk显示文件内容中文乱码

    解决gitk显示文件内容中文乱码 1.git config 命令 设置git gui的界面编码 git config --global gui.encoding utf-8 2.修改配置文件 在~\e ...

  7. 解决PLSQL Developer 插入中文 乱码问题(转)

    原文地址:解决PLSQL Developer 插入中文 乱码问题 PLSQL Developer 插入中文 乱码问题,如图     这个是由于oracle服务器端字符编码 和 Oracle 客户端 字 ...

  8. 解决windows下vim中文乱码

    解决windows下vim中文乱码 windows安装了vim8,也就是gvim后,打开带有中文的文档,显示中文是乱码. 毕竟有许多文档我是用utf-8编码的,所以解决的办法是设置一下编码为utf-8 ...

  9. tomcat7解决jsp参数传递的中文乱码问题

    解决jsp参数传递的中文乱码问题 制作人:全心全意 在jsp页面中,通过参数传递传递中文时,在显示参数值时中文内容变成了乱码.这是因为请求参数的文字编码方式与页面中的不一致造成的,所有的request ...

随机推荐

  1. 广义线性模型(Generalized Linear Models)

    前面的文章已经介绍了一个回归和一个分类的例子.在逻辑回归模型中我们假设: 在分类问题中我们假设: 他们都是广义线性模型中的一个例子,在理解广义线性模型之前需要先理解指数分布族. 指数分布族(The E ...

  2. php抽奖代码

    1.经典概率算法抽奖 $tmpItems = ['电脑'=>10, '相机'=>50, '100元现金'=>500]; $proSum = array_sum($tmpItems); ...

  3. How GitHub Works《Github是如何工作的?》

    https://github.com/blog/920-how-github-works 如果你想知道Github是如何工作的,你可以看查看Zach Holman(@holman)的三篇文章: Hou ...

  4. AgileEAS.NET SOA 中间件Web运行容器管理功能已全部开源,欢迎大家下载、使用、反馈

    一.前言 AgileEAS.NET SOA 中间件平台是一款基于基于敏捷并行开发思想和Microsoft .Net构件(组件)开发技术而构建的一个快速开发应用平台.用于帮助中小型软件企业建立一条适合市 ...

  5. 【leetcode】Pascal's Triangle

    题目简述: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5 ...

  6. 【leetcode】Longest Substring Without Repeating Characters

    题目描述: Given a string, find the length of the longest substring without repeating characters. For exa ...

  7. CozyRSS开发记录8-解析一份RSS

    CozyRSS开发记录8-解析一份RSS 1.使用Rss20FeedFormatter解析RSS 使用Rss20FeedFormatter配合XmlReader来解析RSS非常的简单,几行搞定: 来试 ...

  8. 学习微信小程序之css7

    盒模型 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...

  9. SQL Server 递归

    SQL Server 没有类似于Oracle START WITH NAME='xx' CONNECT BY PRIOR ID=PARENT_ID这样的语句,但是可以通过自定义标准函数+With语句实 ...

  10. 【微信开发】—7200s限制,非数据库

    两种微信缓存方式(7200s) 第一种是MemoryCache(缓存的分享票据) public static string Getjsapi_ticket(string AppID, string A ...