characters

How to save Chinese Characters to file with java ?

I use the following code to save Chinese characters into a .txt file, but when I opened it with wordpad, I can't read it. StringBuffer Shanghai_StrBuf=new StringBuffer("\u4E0A\u6D77"); boolean Append=true; FileOutputStream fos; fos=new FileOutputStream(FileName,Append); for (int i=0;i<Shanghai_StrBuf.length();i++) fos.write(Shanghai_St...

Firefox and magically appearing character (Â) when unescaping an ®

I'm unescaping an ® (registration character) in firefox to be submitted in a form, since actually typing that character into Javascript causes the script to behave strangely. However, I must use the unescaped(..) version of the character since it is being submitted to the backend (where I have no control) and the output is a pdf file wh...

C# Stripping / converting one or more characters

Hi all, Is there a fast way (without having to explicitly looping through each character in a string) and either stripping or keeping it. In Visual FoxPro, there is a function CHRTRAN() that does it great. Its on a 1:1 character replacement, but if no character in the alternate position, its stripped from the final string. Ex CHRTRA...

C++ String Length?

How should I get the number of characters in a string in C++? ...

NSString: Number of Occurrences of a Character?

I have an NSString and would like to get the number of occurrences of a particular character. I need to do this for quite a few characters, so it would be nice for it to be quick. In case it makes any difference, it's actually an NSMutableString, and the characters will all be uppercase English letters. ...

rijndael encryption

does this encryption library use pipe characters? I'm storing the key in an array with the corresponding UserID value, and delimiting them with a pipe character. If the library generates keys with pipe characters, those keys will get mangled when I split the string later. ...

How do I search Google for code and other programming related keywords? It seems to strip special characters

One of the problems I have with Google is that it seems to strip special characters like dots, commas and some other special characters, which are usually what I'm looking for when I'm trying to find anything programming-related ex: django @ sign returns irrelevant data. Perhaps you know a way (or an alternative/technique) to make this ...

Method to substitute foreign for English characters in Java?

In PHP I would use this: $text = "Je prends une thé chaud, s'il vous plaît"; $search = array('é','î','è'); // etc. $replace = array('e','i','e'); // etc. $text = str_replace($search, $replace, $text); But the Java String method "replace" doesn't seem to accept arrays as input. Is there a way to do this (without having to resort to a f...

Is there something like java's Character.digit(char ch, int radix) in c#?

Character.digit(char ch, int radix) Returns the numeric value of the character ch in the specified radix. Is there an equivalent function in c#? ...

What characters have to be escaped to prevent (My)SQL injections?

Hi, I'm using MySQL API's function mysql_real_escape_string() Based on the documentation, it escapes the following characters: \0 \n \r \ ' " \Z Now, I looked into OWASP.org's ESAPI security library and in the Python port it had the following code (http://code.google.com/p/owasp-esapi-python/source/browse/esapi/codecs/mysql.py): ...

Is storing URL-encoded text in the database a good idea?

I need to store (possibly long) text in a MySQL database. The text may contain special characters and non-latin letters and it should be possible to perform full-text-search on it. MySQL 5 can't store such characters (but it will be possible in MySQL 6), so I though about URL-encoding the text before storing it and decoding it after fetc...

Replace character in SQL results

This is from a Oracle SQL query. It has these weird skinny rectangle shapes in the database in places where apostrophes should be. (I wish we would could paste screen shots in here) It looks like this when I copy and paste the results. spouse�s is there a way to write a SQL SELECT statement that searches for this character in the fie...

random.sample return only characters instead of strings

Hi SO, This is a kind of newbie question, but I couldn't find a solution. I read a list of strings from a file, and try to get a random, 5 element sample with random.sample, but the resultung list only contains characters. Why is that? How can I get a random sample list of strings? This is what I do: names = random.sample( open('n...

Export Gridviw to PDF with international characters

Hi There, I have a Gridview with some international characters, How do I add this characters (Fonts) when I export it to PDF format? any idea? Thanks in advance ...

can Mysql or sqlite Blob data type store varchar data in it?

Hi All, Can one anyone provide any information on whether can we store normal text data(varchar) in mysql or sqlite Blob data type ...

PHP Limit string output by specific characters

Hello, I am trying to limit the number of characters returned from a string using PHP. I've applied a solution that just seemed to crash the server (high load) / infinite loop. So I am asking for alternative, Simply, I am trying to find a solution that cuts the string, display specific amount of characters, but still respect the meanin...

In Python, how to check if a string only contains certain characters?

In Python, how to check if a string only contains certain characters? I need to check a string containing only a..z, 0..9, and . (period) and no other character. I could iterate over each character and check the character is a..z or 0..9, or . but that would be slow. I am not clear now how to do it with a regular expression. Is this ...

Norwegian characters

I have the following php in my contact form. // Ensure a message was entered, then sanitize it if(!empty($_POST['cf_m']) && $_POST['cf_m']!='Enter Your Message Here') { $message = strip_tags($_POST['cf_m']); } When I receive a message by email, Norwegian characters, å, ø and æ becomes Ã¥, ø, æ What can I do in order to show correc...

Javascript character normalization

hi, im using Google Translate API, and if i try to translate Mc Donald's this is what i get as a result: Mc Donald&#39;s How can i translate &#39; to ' -- in Javascript -- and so on for any other numeric character reference? Thanks! ...

Get supported characters of a font - in C#

I have a third party font with support for japanese characters which I need to use for an application. Whenever a character is not supported by this font, the often seen rectangle ("default character") is drawn. Obviously not all japanese characters are supported, because if I try to draw the translations that our translation office gave...