首页 \ 问答 \ 修复破解的UTF8编码(Fixing Broken UTF8 encoding)

修复破解的UTF8编码(Fixing Broken UTF8 encoding)

我正在修复一些坏的UTF8编码。 我目前使用的是PHP 5和MySQL

在我的数据库中,我有一些不好的编码实例打印如下:î

  • 数据库整理是utf8_general_ci
  • PHP正在使用正确的UTF8标题
  • Notepad ++设置为使用没有BOM的UTF8
  • 数据库管理在phpMyAdmin中处理
  • 并非所有重音字符都被打破

我需要的是一些功能,将帮助我将î,ÃÂ,ü¼和其他类似的实例映射到适当的重音UTF8字符。


I am in the process of fixing some bad UTF8 encoding. I am currently using PHP 5 and MySQL

In my database I have a few instances of bad encodings that print like: î

  • The database collation is utf8_general_ci
  • PHP is using a proper UTF8 header
  • Notepad++ is set to use UTF8 without BOM
  • database management is handled in phpMyAdmin
  • not all cases of accented characters are broken

What I need is some sort of function that will help me map the instances of î, í, ü and others like it to their proper accented UTF8 characters.


原文:https://stackoverflow.com/questions/1344692
更新时间:2022-11-18 09:11

最满意答案

下划线和光标代表Listbox项目的不同属性 -

  • 下划线标记(它是Listbox的默认活动activestyle属性)显示活动项目。

  • 光标用于(a)选定的项目。

默认情况下,Tab键在此上下文中交替显示“活动”状态,因此它不会影响游标。

要更改光标位置,我们需要将活动项目设置为(a)所选项目。 我通过将Tab键绑定到执行此额外manouver的lambda函数来完成此操作:

l1.bind('<Tab>', lambda e: l2.select_set(l2.index(ACTIVE)))
l2.bind('<Tab>', lambda e: l1.select_set(l1.index(ACTIVE)))

活动索引作为参数提供给相应的select_set() ,然后将光标移动到下划线项目上。

注:我认为对于更一般的情况,事件e应该用于拾取活动项目,而不是直接引用列表框。 但是,这似乎适用于2个列表框。


The underscore and cursor represent different attributes of Listbox items -

  • The underscore marking, which is the default activestyle attribute of a Listbox, shows the active item.

  • The cursor is for (a) selected item(s).

The Tab key, by default, alternates the "active" state in this context, so it does not affect the cursor.

To change the cursor position, we need to set the active item to be the (a) selected item as well. I've done so by binding the Tab key to lambda functions that perform this additional manouver:

l1.bind('<Tab>', lambda e: l2.select_set(l2.index(ACTIVE)))
l2.bind('<Tab>', lambda e: l1.select_set(l1.index(ACTIVE)))

The active index is given as an argument to the appropriate select_set(), which then moves the cursor over the underscored item.

Note: I think that for a more general case, the event e should be used to pick up the active item, rather than referring to the Listboxes directly. However, this seems to work fine for 2 listboxes.

相关问答

更多
  • command期望函数名称不带()和参数。 错误: command=player.do_action(action, **action.kwargs) 这样就可以分配给player.do_action()返回的command值,但是这个函数返回None 你必须使用lambda函数 command=lambda:player.do_action(action, **action.kwargs) 但也许你还需要lambda参数,因为你在for循环中创建它。 command=lambda act=action ...
  • 您可以将selectbackground添加到insert()循环中: for i, c in enumerate(color_palette): _col_pick.insert(tk.END, c) _col_pick.itemconfig(i, {'bg':c, 'selectbackground':c}) 这会将选择的背景设置为相同的颜色。 You can add selectbackground to your insert() loop: for i, c in enumera ...
  • 运行tkinter._test() 。 注意括号。 Run tkinter._test(). Note the parenthesis.
  • 下划线和光标代表Listbox项目的不同属性 - 下划线标记(它是Listbox的默认活动activestyle属性)显示活动项目。 光标用于(a)选定的项目。 默认情况下,Tab键在此上下文中交替显示“活动”状态,因此它不会影响游标。 要更改光标位置,我们需要将活动项目设置为(a)所选项目。 我通过将Tab键绑定到执行此额外manouver的lambda函数来完成此操作: l1.bind('', lambda e: l2.select_set(l2.index(ACTIVE))) l2.bind ...
  • 当Entry获得焦点时,可以使用bind来运行函数。 txtbox2.bind('', fn_jump) 要使用bind,您调用的函数必须接受一个事件参数,因此将该定义更改为 def fn_jump(event=None): You can do that by using bind to run a function when the Entry gets focus. txtbox2.bind('', fn_jump) To use bind, the func ...
  • 正如在帖子“Tkinter主窗口焦点”中提到的那样,可以将焦点强制到主窗口。 解决方法 - 将一个调用添加到after()到focus_force() 。 from tkinter import * main = Tk() def pressButton(): main.destroy() End=Button(main,text='Finished',width=15,command=pressButton).grid() # call the focus_force() after the w ...
  • 一个项目在您点击它之后变为活动状态 - 这意味着您的ListboxSelect方法返回后。 所以,你打印出这个点击之前所有活动的内容(通常意思是你上次点击的内容)。 另外,考虑到你多次提及“选择”,我想你想要的是选定的值,而不是活动的 ,所以你应该问这个问题。 对于带有selectmode=SINGLE或BROWSE (默认,你有什么)列表框的列表框,你可以修复这两个。 只需改变这一点: mylistbox.get(ACTIVE) 至: mylistbox.get(mylistbox.curselecti ...
  • Tkinter小部件可以占用多个网格单元,但您需要使用columnspan和rowspan关键字.grid管理布局.grid 。 例如,要获得布局: -------------------------------------------- | Button1 | Button2 | | -------------------------------- Button3 | | Label1 | Label2 | Label3 | ...
  • 找到一些时间提供工作实例;) import Tkinter import tkMessageBox root = Tkinter.Tk() but1 = Tkinter.Button(root, text ="Button 1") but1.pack() butNoFocus = Tkinter.Button(root, text ="Button no focus", takefocus = 0) butNoFocus.pack() but2 = Tkinter.Button(root, text ...
  • 本身没有任何内置功能,但如果您愿意发挥创意,那么您想要做的就是可能。 在它的核心,文本小部件是一个tcl命令,每当文本小部件发生某些事情时都会调用此命令:插入文本,删除文本,光标更改等.tcl的本质是我们可以用我们自己的命令替换此命令命令。 由于我们可以做到这一点,我们可以检测到某些变化,并在之前或之后调用我们自己的函数。 听起来很复杂,而且确实很复杂。 从积极的方面来说,一旦你有它工作,它是万无一失的,这意味着你不必做任何自定义绑定。 要查看完整的工作示例,请参阅绑定到光标移动的问题的答案 不会更改INS ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)