Search Results

Search found 36172 results on 1447 pages for 'unicode string'.

Page 7/1447 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • std::string.resize() and std::string.length()

    - by dreamlax
    I'm relatively new to C++ and I'm still getting to grips with the C++ Standard Library. To help transition from C, I want to format a std::string using printf-style formatters. I realise stringstream is a more type-safe approach, but I find myself finding printf-style much easier to read and deal with (at least, for the time being). This is my function: using namespace std; string formatStdString(const string &format, ...) { va_list va; string output; size_t needed; size_t used; va_start(va, format); needed = vsnprintf(&output[0], 0, format.c_str(), va); output.resize(needed + 1); // for null terminator?? used = vsnprintf(&output[0], output.capacity(), format.c_str(), va); // assert(used == needed); va_end(va); return output; } This works, kinda. A few things that I am not sure about are: Do I need to make room for a null terminator, or is this unnecessary? Is capacity() the right function to call here? I keep thinking length() would return 0 since the first character in the string is a '\0'. Occasionally while writing this string's contents to a socket (using its c_str() and length()), I have null bytes popping up on the receiving end, which is causing a bit of grief, but they seem to appear inconsistently. If I don't use this function at all, no null bytes appear.

    Read the article

  • Python 3.1, trying to unescape html/unicode/xml characters

    - by Sho Minamimoto
    I found my problem here, but there is only an answer for Python 2.6. Basically, I need to unescape strings such as this: 'a altieri_joão' to show the proper characters. http://stackoverflow.com/questions/990169/how-do-convert-unicode-escape-sequences-to-unicode-characters-in-a-python-string I need to do this in 3.1, but when I try print (u'a altieri_jo&#xe3;o') if gives me invalid syntax. And when I try name.decode('latin-1') it says 'str' has no method 'decode'.

    Read the article

  • complete, monospaced Unicode font?

    - by nachik
    I'm looking for a good programming font that lets me add comments and string literals in Unicode, usually Japanese and Chinese along with some Latin and Cyrillic languages. So far the situation seems to be "complete, monospace, free, pick 2" and Google is failing me with this (maybe because there are no good ones?). The best I found is Arial Unicode but it's not monospace, which is a big nuisance for me and the editors I use. Not to mention Python indentation when I'm coding Python. (Links, edits are welcome)

    Read the article

  • Using a Unicode format for Python's `time.strftime()`

    - by Hosam Aly
    I am trying to call Python's time.strftime() function using a Unicode format string: u'%d\u200f/%m\u200f/%Y %H:%M:%S' (\u200f is the "Right-To-Left Mark" (RLM).) However, I am getting an exception that the RLM character cannot be encoded into ascii: UnicodeEncodeError: 'ascii' codec can't encode character u'\u200f' in position 2: ordinal not in range(128) I have tried searching for an alternative but could not find a reasonable one. Is there an alternative to this function, or a way to make it work with Unicode characters?

    Read the article

  • Regex Not Matching Unicode

    - by cam
    How would I go about using Regex to match Unicode strings? I'm loading in a couple keywords from a text file and using them with Regex on another file. The keywords both contain unicode (such á, etc). I'm not sure where the problem is. Is there some option I have to set?

    Read the article

  • Converting Unicode strings to escaped ascii string

    - by Ali
    How can I convert this string: This string contains the unicode character Pi(p) into an escaped ascii string: This string contains the unicode character Pi(\u03a0) and vice versa ? The current Encoding available in C#, converts the p character into "?". I need to preserve that character.

    Read the article

  • Unicode replacement characters for text matching

    - by Christian Harms
    I have some fun with unicode text sources (all correct encodet) and I want to match names. The classic problem, one source comes correctly, an other has more flatten names: "Elblag" vs. "Elblag" (see the character a) How can I "flatten" a, á, â or à to a for better matching? Are there unicode to ascii- matching tables?

    Read the article

  • Java Unicode encoding

    - by Marcus
    A Java char is 2 bytes (max size of 65,536) but there are 95,221 Unicode characters. Does this mean that you can't handle certain Unicode characters in a Java application? Does this boil down to what character encoding you are using?

    Read the article

  • passing unicode string from C# exe to C++ DLL

    - by Martin
    Using this function in my C# exe, I try to pass a Unicode string to my C++ DLL: [DllImport("Test.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int xSetTestString(StringBuilder xmlSettings); This is the function on the C++ DLL side: __declspec(dllexport) int xSetTestString(char* pSettingsXML); Before calling the function in C#, I do a MessageBox.Show(string) and it displays all characters properly. On the C++ side, I do: OutputDebugStringW((wchar_t*)pString);, but that shows that the non-ASCII characters were replaced by '?'.

    Read the article

  • Python, Unicode, and the Windows console

    - by James Sulak
    When I try to print a Unicode string in a windows console, I get a "UnicodeEncodeError: 'charmap' codec can't encode character ...." error. I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this? Is there any way I can make Python automatically print a "?" instead of failing in this situation? Edit: I'm using Python 2.5.

    Read the article

  • Unicode characters and IE

    - by findmeahamper
    I just built a site that relies on certain Unicode characters like &#9398;, but have just realized that IE doesn't show these characters? Is there some meta tag to get the browser to show it or how do you update IE to handle these Unicode characters?

    Read the article

  • Django approximate matching of unicode strings with ascii equivalents

    - by c
    I have the following model and instance: class Bashable(models.Model): name = models.CharField(max_length=100) >>> foo = Bashable.objects.create(name=u"piñata") Now I want to be able to search for objects, but using ascii characters rather than unicode, something like this: >>> Bashable.objects.filter(name__lookslike="pinata") Is there a way in Django to do this sort of approximate string matching, using ascii stand-ins for the unicode characters in the database? Here is a related question, but for Apple's Core Data.

    Read the article

  • IIS 6.0 Server and Unicode Characters

    - by Srikanth
    We are performing a pen test on a simple asp application that uses MS SQL Database. It seems for the authentication they are using dynamic constructed queries but escaping single qoutes. When we use Unicode quotes like %uFFO7,%u02b9 etc we are able to successfully inject SQL injections. Want to understand is it more a kind of configuration issue of IIS server to cannonicalize Unicode characters or the way the validation function to escape single quotes is written is the cause of the problem?

    Read the article

  • Displaying unicode character U+2661 ("White Heart Suit") in Windows 7

    - by Jordan
    I can't get this character: ? to display properly in Windows Explorer, it instead shows up as a symbol of three lines, similar to this ?. The strangest thing is that if i use the heart symbol beside another unusual symbol, such as one of these: ??????, it will display correctly as a heart; yet if I delete the symbol which is next to the heart it will revert to the 3 lines symbol. All of these other symbols display correctly when used alone. Does anybody else have this problem? Is it possible that Windows has 2 different characters listed for U+2661? Thanks for any help

    Read the article

  • Telugu (unicode) font rendering in emacs

    - by Prakash K
    [I asked the following question in stackoverflow, and I have been redirected here. I hope I can get some answers here. My question at stackoverflow had two small images showing the example rendering of text. As a new user at superuser, I am not being allowed to include them here, nor I am allowed to post more than one hyperlink. And, I don't have enough reputation on SO to migrate that question. Please look at the stackoverflow question for the images. Sorry about the inconvenience.] I sometimes edit text in telugu language. However, when I open the file (UTF-8 encoded) in GNU emacs (version 23.1.50.1 on Ubuntu Jaunty) the text rendering is incorrect. The same text file opened in gedit is rendered correctly. Here's a snippet: ????????? ???? ???? ???????? rendred in gedit: Please see the SO question for the image showing telugu text rendering in gedit And, the emacs rendering of the same text: Please see the SO question for the image showing telugu text rendering in emacs Wherever glyphs need to be composited (not sure if it's the right word), emacs (or whatever library it uses) is not doing it right. Is there anyway to fix this? Perhaps tuning some setting in my configuration? Any ideas, please?

    Read the article

  • Telugu (unicode) font rendering in emacs

    - by Prakash K
    I sometimes edit text in telugu language. However, when I open the file (UTF-8 encoded) in GNU emacs (version 23.1.50.1 on Ubuntu Jaunty) the text rendering is incorrect. The same text file opened in gedit is rendered correctly. Here's a snippet: ????????? ???? ???? ???????? rendred in gedit: And, the emacs rendering of the same text: Wherever glyphs need to be composited (not sure if it's the right word), emacs (or whatever library it uses) is not doing it right. Is there anyway to fix this? Perhaps tuning some setting in my configuration? Any ideas, please?

    Read the article

  • Cannot use Alt code for Unicode character insertion any more

    - by Bergi
    I've been using the Alt code for the ellipsis, 8230, for some time now, in several applications. A few days ago it stopped working, and & is displayed instead of … when pressing Alt+8+2+3+0 (on numpad). This happened both on my desktop and on my laptop (where I use it with Fn). Both run on 64bit-Win-7 with code page 850, and both might have recently updated Windows and Opera 12. What could be the reason this input method got disabled, and how do I switch it back? Btw, I just found out that Alt+0+1+3+3 does work.

    Read the article

  • SQL SERVER – Order By Numeric Values Formatted as String

    - by pinaldave
    When I was writing this blog post I had a hard time to come up with the title of the blog post so I did my best to come up with one. Here is the reason why? I wrote a blog post earlier SQL SERVER – Find First Non-Numeric Character from String. One of the questions was that how that blog can be useful in real life scenario. This blog post is the answer to that question. Let us first see a problem. We have a table which has a column containing alphanumeric data. The data always has first as an integer and later part as a string. The business need is to order the data based on the first part of the alphanumeric data which is an integer. Now the problem is that no matter how we use ORDER BY the result is not produced as expected. Let us understand this with example. Prepare a sample data: -- How to find first non numberic character USE tempdb GO CREATE TABLE MyTable (ID INT, Col1 VARCHAR(100)) GO INSERT INTO MyTable (ID, Col1) SELECT 1, '1one' UNION ALL SELECT 2, '11eleven' UNION ALL SELECT 3, '2two' UNION ALL SELECT 4, '22twentytwo' UNION ALL SELECT 5, '111oneeleven' GO -- Select Data SELECT * FROM MyTable GO The above query will give following result set. Now let us use ORDER BY COL1 and observe the result along with Original SELECT. -- Select Data SELECT * FROM MyTable GO -- Select Data SELECT * FROM MyTable ORDER BY Col1 GO The result of the table is not as per expected. We need the result in following format. Here is the good example of how we can use PATINDEX. -- Use of PATINDEX SELECT ID, LEFT(Col1,PATINDEX('%[^0-9]%',Col1)-1) 'Numeric Character', Col1 'Original Character' FROM MyTable ORDER BY LEFT(Col1,PATINDEX('%[^0-9]%',Col1)-1) GO We can use PATINDEX to identify the length of the digit part in the alphanumeric string (Remember: Our string has a first part as an int always. It will not work in any other scenario). Now you can use the LEFT function to extract the INT portion from the alphanumeric string and order the data according to it. You can easily clean up the script by dropping following table. DROP TABLE MyTable GO Here is the complete script so you can easily refer it. -- How to find first non numberic character USE tempdb GO CREATE TABLE MyTable (ID INT, Col1 VARCHAR(100)) GO INSERT INTO MyTable (ID, Col1) SELECT 1, '1one' UNION ALL SELECT 2, '11eleven' UNION ALL SELECT 3, '2two' UNION ALL SELECT 4, '22twentytwo' UNION ALL SELECT 5, '111oneeleven' GO -- Select Data SELECT * FROM MyTable GO -- Select Data SELECT * FROM MyTable ORDER BY Col1 GO -- Use of PATINDEX SELECT ID, Col1 'Original Character' FROM MyTable ORDER BY LEFT(Col1,PATINDEX('%[^0-9]%',Col1)-1) GO DROP TABLE MyTable GO Well, isn’t it an interesting solution. Any suggestion for better solution? Additionally any suggestion for changing the title of this blog post? Reference : Pinal Dave (http://blog.SQLAuthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Python string formatting when string contains "%s" without escaping

    - by Stephen Gornick
    When formatting a string, my string may contain a modulo "%" that I do not wish to have converted. I can escape the string and change each "%" to "%%" as a workaround. e.g., 'Day old bread, 50%% sale %s' % 'today!' output: 'Day old bread, 50% sale today' But are there any alternatives to escaping? I was hoping that using a dict would make it so Python would ignore any non-keyword conversions. e.g., 'Day old bread, 50% sale %(when)s' % {'when': 'today'} but Python still sees the first modulo % and gives a: TypeError: not enough arguments for format string

    Read the article

  • String Formatting Tricks/Docs

    - by Meltemi
    Was reading the response by Shaggy Frog to this post and was intrigued by the following line of code: NSLog(@"%@", [NSString stringWithFormat:@"%@:%*s%5.2f", key, padding, " ", [object floatValue]]); I know string formatting is an age old art but I'm kinda doing the end around into Cocoa/Obj-C programming and skipped a few grades along the way. Where is a good (best) place to learn all the string formatting tricks allowed in NSString's stringWithFormat? I'm familiar with Apple's String Format Specifiers page but from what I can tell it doesn't shed light on whatever is happening with %*s or the %5.2f (not to mention the 3 apparent placeholders followed by 4 arguments) above?!?

    Read the article

  • split a string based on pattern in java - capital letters and numbers

    - by rookie
    Hi all I have the following string "3/4Ton". I want to split it as -- word[1] = 3/4 and word[2] = Ton. Right now my piece of code looks like this:- Pattern p = Pattern.compile("[A-Z]{1}[a-z]+"); Matcher m = p.matcher(line); while(m.find()){ System.out.println("The word --> "+m.group()); } It carries out the needed task of splitting the string based on capital letters like:- String = MachineryInput word[1] = Machinery , word[2] = Input The only problem is it does not preserve, numbers or abbreviations or sequences of capital letters which are not meant to be separate words. Could some one help me out with my regular expression coding problem. Thanks in advance...

    Read the article

  • An analog of String.Join(string, string[]) for IEnumerable<T>

    - by abatishchev
    class String contains very useful method - String.Join(string, string[]). It creates a string from an array, separating each element of array with a symbol given. But general - it doesn't add a separator after the last element! I uses it for ASP.NET coding for separating with "<br />" or Environment.NewLine. So I want to add an empty row after each row in asp:Table. What method of IEnumerable<TableRow> can I use for the same functionality?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >