UTF-8 - > ASCII C语言 [英] UTF-8 -> ASCII in C language

查看:141
本文介绍了UTF-8 - > ASCII C语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的问题,我不能在互联网上找到任何地方,我怎么能只使用标准库转换成UTF-8 ASCII(主要是重音符号,以相同的字符没有口音)用C?我发现大多数语言那里的解决方案,而不是对C特别

I have a simple question that I can't find anywhere over the internet, how can I convert UTF-8 to ASCII (mostly accented characters to the same character without accent) in C using only the standard lib? I found solutions to most of the languages out there, but not for C particularly.

谢谢!

编辑:有评论说这让我仔细检查我需要什么,我夸张的那种球员。我只需要在如何使做一个功能的想法:与口音的字符 - >字符没有口音。 :)

Some of the kind guys that commented made me double check what I needed and I exaggerated. I only need an idea on how to make a function that does: char with accent -> char without accent. :)

推荐答案

有没有建在这样做的方式。还有,除非你在谈论高级别的人物,这是不能被重新在ASCII psented反正$ P $ UTF-8和ASCII之间的真正差别不大。

There's no built in way of doing that. There's really little difference between UTF-8 and ASCII unless you're talking about high level characters, which cannot be represented in ASCII anyway.

如果你有你想要的(如带有口音 - > A)特定的映射。那么你应该只可能处理这个作为一个字符串替换操作

If you have a specific mapping you want (such as a with accent -> a) then you should just probably handle that as a string replace operation.

这篇关于UTF-8 - > ASCII C语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆