I currently have the ASP following code, where if a particular non-Latin character "д" appears in my search string, I get a desired response as below.  myQuery = request("myQuery")  If InStr(1, myQuery, "д", 1) &gt; 0 then     Response.write "Query from languages ......  detected."   Else      Response.write "Continue searching English/Latin archive." End if   But how do I replace my single character with an array of characters:  myArray = Array("ß","ü","ş","ğ", "ä", "д", "ф")   In other words, how do I check to see if any of the characters in myArray appears in myQuery?
122512
In the code below  For i = LBound(arr) To UBound(arr)   What is the point in asking using LBound? Surely that is always 0.
118141
Too often I messed with bad formated BibTeX files from references databases that are infected with active characters  as % or &amp; (usually in the abstract, that is not printed but produce an error anyway) but I can live with this inconvenient and replace those by with \% or \&amp;.   Also with some input encoding errors due to some UTF8 character that cannot be managed by pdflatex. In references this error is more disturbing that in the main text, but in best cases, is only change some greek letter as γ. In others is the insidious zero width U+200B, but with I can search and replace even this character.    The worse for me is the obnoxious U+301, specially when is not in over a consonant but hiding in vowels as normal acute characters, that are perfectly managed using inputenc, i.e., the   normal e character (U+0065) plus U+301 look exactly like the kind é (U+00E9) and so on with á, Á, í, etc., so if is hard detect the poisonous diacritic mark.   Disappointingly, search U+0065 plus U+301 find also the single character U+00E9 and vice versa in some editors, so I ended with the pain of searching &amp; replacing every accented letter (single or double) with the single character versión.    So the question is specifically is: There are clevers ways to sanitize .bib files with U+301 tildes?   (Of course, a more general answer, covering some automagic cleaning of all unrecognized and active characters will be welcome.)  The minimal (not) working example:   \documentclass{article} \begin{filecontents}{test.bib} @article{xx, author={González, M. and Ruíz, P.} title={Mañana hará calor &amp; bochorno con un 90% de humedad} }    \end{filecontents} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[spanish]{babel} \begin{document} Hello  \cite{xx} \bibliography{test} \bibliographystyle{plain} \end{document}
108707
You can search for anything on Google, right? At least, so I thought. I was trying to see how the special characters get encoded in the url, like how &amp; gets converted to %26. I started searching for *. It did not get encoded, but weirdly google didn't tell me that it was an asterisk symbol. All other search engines (yahoo, bing, duckduckgo) did.   See for yourself : . Basically it treats it as a regular expression. So *+* will also not give any results. Still, shouldn't Google at least say that * is the asterisk symbol.  I don't know where else to ask this question, so I came to SO.
85205
I'm working on a project that generates PDFs that can contain fairly complex math and science formulas.  The text is rendered in Times New Roman, which has pretty good Unicode coverage, but not complete. We have a system in place to swap in a more Unicode complete font for code points that don't have a glyph in TNR (like most of the "stranger" math symbols,) but I can't seem to find a way to query the *.ttf file to see if a given glyph is present.  So far, I've just hard-coded a lookup table of which code points are present, but I'd much prefer an automatic solution.  I'm using VB.Net in a web system under ASP.net, but solutions in any programming language/environment would be appreciated.  Edit: The win32 solution looks excellent, but the specific case I'm trying to solve is in an ASP.Net web system.  Is there a way to do this without including the windows API DLLs into my web site?
121704
I have a listing to be used in verbatim (acutally Verbatim) that uses unicode characters such as ∀, ∃, →, ∨. Using  \DeclareUnicodeCharacter{2203}{\ensuremath\exists}   they do appear in the listing, but obviously in the wrong font.  For → I got the desired result using  \usepackage{textcomp} \DeclareUnicodeCharacter{2192}{\ifmmode\to\else\textrightarrow\fi}   but I do not see how to do it for ∃, ∀ and ∨.  MWE:  \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} \DeclareUnicodeCharacter{2192}{\ifmmode\to\else\textrightarrow\fi} \DeclareUnicodeCharacter{2203}{\ensuremath\exists} \begin{document} \begin{verbatim} Make this → ∃ look nice! \end{verbatim} \end{document}   I’d like to stick to latex (i.e. not xetex). I would prefer to stick to the default type writer font (Computer Modern Typewriter), but if it only works with a different font (such as DejaVu Sans Mono), then that would be ok as well.
102296
I have an ActiveRecord model, Foo, which has a name field.  I'd like users to be able to search by name, but I'd like the search to ignore case and any accents.  Thus, I'm also storing a canonical_name field against which to search:  class Foo   validates_presence_of :name    before_validate :set_canonical_name    private    def set_canonical_name     self.canonical_name ||= canonicalize(self.name) if self.name   end    def canonicalize(x)     x.downcase.  # something here   end end   I need to fill in the "something here" to replace the accented characters.  Is there anything better than  x.downcase.gsub(/[àáâãäå]/,'a').gsub(/æ/,'ae').gsub(/ç/, 'c').gsub(/[èéêë]/,'e')....   And, for that matter, since I'm not on Ruby 1.9, I can't put those Unicode literals in my code.  The actual regular expressions will look much uglier.
47519
Every time a user posts something containing &lt; or &gt; in a page in my web application, I get this exception thrown.  I don't want to go into the discussion about the smartness of throwing an exception or crashing an entire web application because somebody entered a character in a text box, but I am looking for an elegant way to handle this.  Trapping the exception and showing     An error has occurred please go back and re-type your entire form again, but this time please do not use &lt;   doesn't seem professional enough to me.  Disabling post validation (validateRequest="false") will definitely avoid this error, but it will leave the page vulnerable to a number of attacks.  Ideally: When a post back occurs containing HTML restricted characters, that posted value in the Form collection will be automatically HTML encoded. So the .Text property of my text-box will be something &amp; lt; html &amp; gt;  Is there a way I can do this from a handler?
13909
When encoding a query string to be sent to a web server - when do you use escape() and when do you use encodeURI() or encodeURIComponent():  Use escape:  escape("% +&amp;=");   OR  use encodeURI() / encodeURIComponent()  encodeURI("http://www.google.com?var1=value1&amp;var2=value2");  encodeURIComponent("var1=value1&amp;var2=value2");
65694
I've got a FileUpload control in an ASP.NET web page which is used to upload a file, the contents of which (in a stream) are processed in the C# code behind and output on the page later, using HtmlEncode.   But, some of this output is becoming mangled, specifically the symbol '£' is output as the Unicode FFFD REPLACEMENT CHARACTER. I've tracked this down to the input file, which is Windows 1252 ('ANSI') encoded.   The question is,   How do I determine whether the file is encoded as 1252 or UTF8? It could be either, and How do I convert it to UTF8 if it is in Windows 1252, preserving the symbol £ etc?   I've looked online but cannot find a satisfactory answer.
106681
The new search function allows quoted queries that include punctuation, and this is fantastic, most of the time. However, the search considers the punctuation as part of the word itself, so searches for "a test" will not show results containing a test,, a test., or a test?. The reverse is also true.  Is this the intended behavior ? &lt;--(space added so that behavior will show in results.)  It seems that the logical way to do fix this (while maintaining character search) is for queries with punctuation to match results with punctuation, while queries without punctuation to match either with and without.    Example:  vs     A more practical example is described in Arjan's answer below.
114742
I need to include code in the appendix of my thesis. The code contains comments and the compilation instantly breaks returning:  Unicode char �\lst@FillFixed@ (U+5A8) (inputenc)                not set up for use with LaTeX. l.160       if (lastArg &lt; 0, lastArg = 360°                                               + lastArg);   This is only one of many characters which produce problems. I cannot change my entire code just because this won't compile. Is there any way to include code with arbitrary unicode characters? Thank you.   Edit: complete sample code, as requested.  \RequirePackage[l2tabu,orthodox]{nag}   \documentclass[headsepline,footsepline,footinclude=false,oneside,fontsize=11pt,paper=a4,listof=totoc,bibliography=totoc]{scrbook} % one-sided   \usepackage[toc,page]{appendix} \usepackage{listings} \usepackage[utf8]{inputenc}  \lstset{     inputencoding=utf8,   extendedchars=true,   basicstyle=\footnotesize\ttfamily,   showstringspaces=false,   showspaces=false,   numbers=left,   numberstyle=\footnotesize,   numbersep=9pt,   tabsize=2,   breaklines=true,   showtabs=false,   captionpos=b,     literate={ö}{{\"o}}1 {ä}{{\"a}}1 {ü}{{\"u}}1  }  \begin{document}  \begin{appendices} \lstinputlisting{code/power_series.html} \end{appendices}  \end{document}   Relevant content of power_series.html:  if (lastArg &lt; 0, lastArg = 360° + lastArg);   There really is not much to say about this problem. I only want to be able to use all unicode characters inside a listing. Thank you.
64797
Situation: It started out as me  for the literal string C-c in  but it ended up omitting the - sign and showing results which contained the strings C/C++ and C &amp; C++.  is an example of a post which contains that string of characters (yet fails to show up in the results).  Things I've tried:   post suggests that I can use the undocumented code: operator, but when I do that, it just wraps the whole term in double quotes like .  As @terdon in Unix &amp; Linux chat has , using this  does yield some relevant results, but it doesn't show me  that is supposed to be there. edit: It appears that the Symbolhound query no longer returns that result.  Finally,  says that you can search for literal characters, but as you can see:    Quoted phrases are exact matches except for case-sensitivity, for example, you can search  or .  The second example (symbols) leads to 0 results.  So by now I assume that the search engine has changed (but the old documentation still lingers on this site). Is there a method for me to search for strings that include special (or is it literal?) characters?
61185
I'm trying to remove some characters from file(UTF-8). I'm using tr for this purpose:   tr -cs '[[:alpha:][:space:]]' ' ' &lt;testdata.dat    File contains some foreign characters (like "Латвийская" or "àé"). tr doesn't seem to understand them: it treats them as non-alpha and removes too.  I've tried changing some of my locale settings:  LC_CTYPE=C LC_COLLATE=C tr -cs '[[:alpha:][:space:]]' ' ' &lt;testdata.dat LC_CTYPE=ru_RU.UTF-8 LC_COLLATE=C tr -cs '[[:alpha:][:space:]]' ' ' &lt;testdata.dat LC_CTYPE=ru_RU.UTF-8 LC_COLLATE=ru_RU.UTF-8 tr -cs '[[:alpha:][:space:]]' ' ' &lt;testdata.dat   Unfortunately, none of these worked.  How can I make tr understand Unicode?
65647
Pattern pattern = Pattern.compile("^[a-z]+$"); String string = "abc-def"; assertTrue( pattern.matcher(string).matches() ); // obviously fails   Is it possible to have the character class match a "-" ?
10505
I have some jQuery/JavaScript code that I want to run only when there is a hash (#) anchor link in a URL. How can you check for this character using JavaScript? I need a simple catch-all test that would detect URLs like these:   example.com/page.html#anchor example.com/page.html#anotheranchor   Basically something along the lines of:  if (thereIsAHashInTheUrl) {             do this; } else {     do this; }   If anyone could point me in the right direction, that would be much appreciated.
35663
My controller code is as follows -          for(String resStr : responseArray){             if(resStr.indexOf('r_error_str') != -1){                 responseString += resStr.substring(resStr.indexOf('=') + 1);                  responseString += '\n';             }         }   but when i display this 'responseString ' String using 'apex:outputLabel or apex:outputText or as Exception message '\n' is not converting in new line. Whole String is coming in one line.  Can anyone explain why is this happining
76127
I have to maintain a large number of classic ASP pages, many of which have tabular data with no sort capabilities at all. Whatever order the original developer used in the database query is what you're stuck with.  I want to to tack on some basic sorting to a bunch of these pages, and I'm doing it all client side with javascript. I already have the basic script done to sort a given table on a given column in a given direction, and it works well as long as the table is limited by certain conventions we follow here.    What I want to do for the UI is just indicate sort direction with the caret character ( ^ ) and ... what?  Is there a special character that is the direct opposite of a caret?  The letter v won't quite cut it.  Alternatively, is there another character pairing I can use?