问题标签 [non-latin]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - 如何在我的 WinForms 应用程序中保存和检索非拉丁字符?
我有一个 WinForms 应用程序,它应该能够保存(到 db)并稍后显示非拉丁字符。我知道它与字符集有关。我的数据库和所有表的默认字符集都设置为 utf8。但这仍然不能保存保留其怪异的非拉丁字符:)。
经过一番谷歌搜索和 SO-ing 之后,我知道这是关于SET NAMES 'utf8'
. 但是我在哪里应用这个?SO上有很多类似的线程处理php,他们说必须SET NAMES 'utf8'
在查询开始时包含。但是在我的代码中,有数百个查询,并且修补每个地方都是一团糟。
如果我需要为此配置 MySQL,那么可以通过编程方式完成吗?我希望通过在连接字符串中设置它来解决一些问题。
我试过这个:
这给出了运行时错误,说连接字符串的格式不正确。
c# - HttpListenerResponse.AddHeader 不喜欢非拉丁符号
所以它适用于 HttpResponse 类:
(我们必须为 IE 编码文件名)但现在应该为 HttpListener 完成。它适用于 IE。问题是 FireFox 和 Chrome 不会像 IE 那样解码编码的标头值,但是 HttpResponse.AddHeader 不允许非拉丁字符(来自 System.Net 的代码):
我尝试使用反射在支票周围走动:
什么都没有出现,但文件名已完全损坏。我应该怎么做才能让它工作?
python - 在 python 中抓取页面时保留非拉丁字符
我有一个程序可以抓取一个页面,解析它的任何链接,然后下载链接到的页面(听起来像一个爬虫,但它不是)并将每个页面保存在一个单独的文件中。用于保存的文件名是页面 url 的一部分。例如,如果我找到指向 www.foobar.com/foo 的链接,我会下载该页面并将其保存在名为 foo.xml 的文件中。
稍后,我需要遍历所有此类文件并重新下载它们,使用文件名作为 url 的最后一部分。(所有页面都来自一个站点。)
它运行良好,直到我在 url 中遇到非拉丁字符。该站点使用utf-8,因此当我下载原始页面并对其进行解码时,它可以正常工作。但是当我尝试使用解码后的 url 下载相应的页面时,它不起作用,因为我认为编码是错误的。我尝试在文件名上使用 .encode() 将其改回,但它没有任何改变。
我知道这一定很简单,并且是我没有正确理解编码问题的结果,但我已经为此苦苦挣扎了很长时间。我已经多次阅读 Joel Spolsky 对编码的介绍,但我仍然无法完全确定在这里做什么。谁能帮我?
非常感谢,bsg
这是一些代码。我没有收到任何错误;但是当我尝试使用页面名称作为 url 的一部分下载页面时,我被告知该页面不存在。当然不是——没有像 abc/x54 这样的页面。
澄清一下:我下载了一个页面的 html,其中包含指向 www.foobar.com/Mehmet Kenan Dalbaşar 的链接,例如,但它显示为 Mehmet_Kenan_Dalba%C5%9Far。当我尝试下载页面 www.foobar.com/Mehmet_Kenan_Dalba%C5%9Far 时,页面是空白的。如何保留 www.foobar.com/Mehmet Kenan Dalbaşar 并在需要时将其返回到站点?
events - 通过 keydown 识别非拉丁字符
某些浏览器存在问题,例如 Firefox。
代码:
当键入非拉丁字符为“<”-“б”-“Б”(俄语)时显示:
Chrome 中的相同字符显示:
问题: 在所有浏览器中识别 keydown 处理程序,而不使用按键(因为不同键盘布局上的不同字符代码)。
c# - Can't get non-latin chars from clipboard on c# correctly
I'm developing a dictionary. I'm using this code, to get text from the clipboard.
First - I can set my keyboard language to EN (english) or BG (bulgarian). The problem occurs when I set my keyboard language to EN and try to copy non-latin chars, then I get ????? instead the correct word. If I set to BG, I get the correct word. I tried to copy non-latin text from UTF-8 and ANSII encoded documents, it's the same, no difference, I get only ?????? (question marks)
internationalization - Eclipse RCP Plugin: Internationalization for non-Latin characters
Im having trouble with Internationalizing my Eclipse RCP application for non-Latin characters.
I am storing Chinese characters in UTF-8 format in the property files. But reading them out does not work properly, they are all displayed like gibberish.
I am wondering if there is an easier way to do this, without overriding the provided NLS classes.
sql-server - 东部字符集导致 SQL Server 2012 出现问题
我有一张包含内容的表格:
及其架构:
如果我运行:
我得到:
这是两行,它应该只返回带有“ការអភិវឌ្ឍសហគមន៍”的行,在柬埔寨语中是“社区发展”。
这是一个 NVARCHAR 列,我正在选择 N' 等?有任何想法吗?
android - android中非拉丁字符的识别
我正在尝试在我的 android 活动中获取按键代码
但 keyCode 不依赖于键盘布局。对于拉丁字符,它可以正常工作,但对于非拉丁字符,例如 "П","Э","б"(russian) keyCode 从按下的键返回拉丁符号的代码。似乎,该键码仅取决于键,而不是键盘布局。
这种方式带有拉丁符号 G 的键将为每个键盘布局返回 G 的 keyCode。
我该如何解决?
php - str_word_count does not properly handle non-latin characters
I'm using php 5.3 and I want to count the words of some text for validation reason. My problem is that the javascript functionality that I have for the validation text, returns different number of words according the php functionality.
Here is the php code:
I noticed that with php 5.5, I get the right number of the words but with php 5.3 not. I searched about that and I found this link (http://grokbase.com/t/php/php-bugs/12c14e0y6q/php-bug-bug-63663-new-str-word-count-does-not-properly-handle-non-latin-characters) that explains about the bug that php 5.3 has regarding with the latin characters. I tried to solve it with this code:
But I still didn't get right result. Basically, the number of the word was very close to the result and sometimes accurate but often I had issues.
我决定创建另一个 php 功能来修复错误。这是php代码:
最后一个代码对我来说很好,我想问两个问题:
- 在第一种情况下我可以对 str_word_count 函数做些什么?
- 如果我的第二个解决方案是准确的,或者我可以做些什么来改进它?