special-characters

UTF-8 encoded html pages show � (questions marks) instead of characters

此生再无相见时 提交于 2019-11-26 06:40:51
问题 I have the standard XAMPP installation on win7 (x64). Having had my share of encoding troubles in a past project where mysql encoding did not match with the php enconding which in turn sometimes output html in other encodings, I decided to consistently encode everything using utf-8. I\'m just getting started with the html markup and am allready experiencing troubles. My page is saved using utf-8 (no BOM, I think ) //update: It turns out this was NOT the case. The file was actually saved with

how do i block or restrict special characters from input fields with jquery?

a 夏天 提交于 2019-11-26 05:48:00
问题 How do I block special characters from being typed into an input field with jquery? 回答1: A simple example using a regular expression which you could change to allow/disallow whatever you like. $('input').on('keypress', function (event) { var regex = new RegExp("^[a-zA-Z0-9]+$"); var key = String.fromCharCode(!event.charCode ? event.which : event.charCode); if (!regex.test(key)) { event.preventDefault(); return false; } }); 回答2: I was looking for an answer that restricted input to only

Special characters in PHP / MySQL

一曲冷凌霜 提交于 2019-11-26 05:36:30
问题 I have in the database words that include special character (in Spanish mostly, like tildes). In the database everything is saved and shown correctly with PHPmyAdmin, but when I get the data (using PHP) and display it in a browser, I get a weird character, like a \"?\" with a square... I need a general fix so I don\'t need to escape each character every time, and also I would be able to insert special Spanish characters from a PHP form into the database... The HTML is correct: <meta http

Java: What does ~ mean

拜拜、爱过 提交于 2019-11-26 03:56:11
问题 In this Java source code I have this line: if ((modifiers & ~KeyEvent.SHIFT_MASK) != 0) .... What does the tilde ~ mean? 回答1: The Tilde ( ~ ) performs a bitwise complement of a numerical value in Java. See: Bitwise complement (~): inverts ones and zeroes in a number 回答2: It is the Unary ~ Bitwise complement operator (quoting) : only used with integer values inverts the bits ie a 0-bit becomes 1-bit and vice versa in all cases ~x equals (-x)-1 See also this page on Bitwise operators on

Remove all special characters except space from a string using JavaScript

落爺英雄遲暮 提交于 2019-11-26 03:51:49
问题 I want to remove all special characters except space from a string using JavaScript. For example, abc\'s test#s should output as abcs tests . 回答1: You should use the string replace function, with a single regex. Assuming by special characters, you mean anything that's not letter, here is a solution: var str = "abc's test#s"; alert(str.replace(/[^a-zA-Z ]/g, "")); 回答2: You can do it specifying the characters you want to remove: string = string.replace(/[&\/\\#,+()$~%.'":*?<>{}]/g, '');

List of special characters for SQL LIKE clause

断了今生、忘了曾经 提交于 2019-11-26 03:48:36
问题 What is the complete list of all special characters for a SQL (I\'m interested in SQL Server but other\'s would be good too) LIKE clause? E.g. SELECT Name FROM Person WHERE Name LIKE \'%Jon%\' SQL Server: % _ [specifier] E.g. [a-z] [^specifier] ESCAPE clause E.g. %30!%%\' ESCAPE \'!\' will evaluate 30% as true \' characters need to be escaped with \' E.g. they\'re becomes they\'\'re MySQL: % - Any string of zero or more characters. _ - Any single character ESCAPE clause E.g. %30!%%\' ESCAPE \

The “backspace” escape character &#39;\\b&#39;: unexpected behavior?

懵懂的女人 提交于 2019-11-26 03:47:36
So I'm finally reading through K&R , and I learned something within the first few pages, that there is a backspace escape character, \b . So I go to test it out, and there is some very odd behavior: #include <stdio.h> main () { printf("hello worl\b\bd\n"); } The output is hello wodl Can anyone explain this? Your result will vary depending on what kind of terminal or console program you're on, but yes, on most \b is a nondestructive backspace. It moves the cursor backward, but doesn't erase what's there. So for the hello worl part, the code outputs hello worl ^ ...(where ^ shows where the

Allowed characters in filename

喜夏-厌秋 提交于 2019-11-26 03:35:05
问题 Where can I find a list of allowed characters in filenames, depending on the operating system? (e.g. on Linux, the character : is allowed in filenames, but not on Windows) 回答1: You should start with the Wikipedia Filename page. It has a decent-sized table (Comparison of filename limitations), listing the reserved characters for quite a lot of file systems. It also has a plethora of other information about each file system, including reserved file names such as CON under MS-DOS. I mention that

removing emojis from a string in Python

走远了吗. 提交于 2019-11-26 02:37:35
问题 I found this code in Python for removing emojis but it is not working. Can you help with other codes or fix to this? I have observed all my emjois start with \\xf but when I try to search for str.startswith(\"\\xf\") I get invalid character error. emoji_pattern = r\'/[x{1F601}-x{1F64F}]/u\' re.sub(emoji_pattern, \'\', word) Here\'s the error: Traceback (most recent call last): File \"test.py\", line 52, in <module> re.sub(emoji_pattern,\'\',word) File \"/usr/lib/python2.7/re.py\", line 151,

How to escape special characters like &#39; in sqlite in android

喜夏-厌秋 提交于 2019-11-26 02:36:19
问题 I have a function which is executing a query on a table in SQLite database. I declare a constant: public static final String CANADA_HISTORY = \"Canada\'s History\"; . This is stored in a String variable let\'s say difficulty , I have one query: Cursor c = mDb.rawQuery(\"select * from Questions_answers where CHAPTERS = \'\"+difficulty+\"\'\" , null); It is throwing an exception near the apostrophe. Logcat output: I/Database( 1170): sqlite returned: error code = 1, msg = near \"s\": syntax