printing backslash AND unicode characters in one field - printing

let's say I want to print a backslash and the pound symbol on a label: \£
I cant. I can only print either the backslash or the pound symbol, but the other one will render incorrectly.
This will print correctly the pound symbol, but will print a cent symbol instead of the backslash:
^XA
^CI28
^FO^AT^FH^FD_c2_a3^FS
^XZ
And this will print correctly the backslash, but not the pound symbol:
^XA
^CI13
^FO^AT^FH^FD_c2_a3^FS
^XZ
Do you know a way to combine these two in one single field ?
Thanks

Use the Field Hex feature:
^XA
^FO10,10^A0,40,40^FH_^FDEuro Symbol/_15/^FS
^XZ

As per ZPL script documents, they mentioned "You can mix character sets on a label." using ^CI command.
But there is no example scripts are available to mix character sets, Instead of that the example scripts are just explaining "how to remap the characters".
Also the document has clearly mentioned that If you want to print backslash, you should use ^CI13(^CI13 must be selected to print a backslash (\)). But If we use ^CI13, Latin characters are not printing properly which expects ^CI28.
So I'm not sure if it's possible to print both Latin characters and backslash (\) in same label.

Related

Is there something wrong with CommonMark?

If you try **b.**a on https://spec.commonmark.org/dingus/, you would see its b. is not bolded.
However, if you just omit the last a, it works.
What is the CommonMark format to bold it correctly (that is bolded a., followed by unbolded b)?
The solution to format the text correctly in CommonMark.
According to section 6.2 of the CommonMark specification, that behaviour is by design:
A delimiter run is either a sequence of one or more * characters [...]
A right-flanking delimiter run is a delimiter run that is (1) not preceded by Unicode whitespace, and either (2a) not preceded by a Unicode punctuation character, or (2b) preceded by a Unicode punctuation character and followed by Unicode whitespace or a Unicode punctuation character.
You can get the desired visual appearance with **b.**​a, where ​ is the HTML entity "zero-width joiner", thus:
**b.**​a
...and we've just found a bug in the rendering here on Stack Overflow. In edit mode, the preview shows it correctly as

Rails 5 - regex - for string not found [duplicate]

I have following regex handy to match all the lines containing console.log() or alert() function in any javascript file opened in the editor supporting PCRE.
^.*\b(console\.log|alert)\b.*$
But I encounter many files containing window.alert() lines for alerting important messages, I don't want to remove/replace them.
So the question how to regex-match (single line regex without need to run frequently) all the lines containing console.log() and alert() but not containing word window. Also how to escape round brackets(parenthesis) which are unescapable by \, to make them part of string literal ?
I tried following regex but in vain:
^.*\b(console\.log|alert)((?!window).)*\b.*$
You should use a negative lookhead, like this:
^(?!.*window\.).*\b(console\.log|alert)\b.*$
The negative lookhead will assert that it is impossible to match if the string window. is present.
Regex Demo
As for the parenthesis, you can escape them with backslashes, but because you have a word boundary character, it will not match if you put the escaped parenthesis, because they are not word characters.
The metacharacter \b is an anchor like the caret and the dollar sign.
It matches at a position that is called a "word boundary". This match
is zero-length.
There are three different positions that qualify as word boundaries:
Before the first character in the string, if the first character is a
word character.
After the last character in the string, if the last
character is a word character.
Between two characters in the string,
where one is a word character and the other is not a word character.

Double \\ in regular expression iOS

Does anyone understand what this (([A-Za-z\\s])+)\\? means?
I wonder why it should be "\\s" and "\\" ?
If I entered "\s", Xcode just doesn't understand and if I entered "\?", it just doesn't match the "?".
I have googled a lot, but I did not find a solution. Anyone knows?
The actual regex is (([A-Za-z\s])+)\?. This matches one or more letters and whitespace characters followed by an question mark. The \ has two different meanings here. In the first instance \s has a fixed meaning and stands for any white space characters. In the second instance the \? means the literal question mark character. The escaping is necessary as the question mark means one or none of the previous otherwise.
You can't type your regex like this in a string literal in C code though. C also does some escaping using the backslash character. For example "\n" is translated to a string containing only a newline character. There are some other escape sequences with special meanings. If the character after the backslash doesn't have a special meaning the backslash is just removed. That means if you want to have a single backspace in your string you have to write two.
So if you wrote your regex string as you wanted you'd get different results as it would be interpreted as (([A-Za-zs])+)? which has a completely different meaning. So when you write a regex in an ObjC (or any other C-based language) string literal you must double all backslash characters.
not sure about ios but same thing happens in java. \ is escape character for java,and c also so when you type \s java reads \ as an escape character.
think of it as if you want to print a \ what will you have to do.
you will have to type \\. now first \ will work as escape character for java and second one will be printed.
I think it should be the same concept for ios too.
so if you want \s you type \s, if you want \ you type \\.
The \s metacharacter is used to find a whitespace character.
Refer this!

iPhone - Localizable.strings - string with single quotes inside

I need to add some french translation into iOS Application. But I don know how to use single qute char in the Localizable.strings file.
For example text :
"Invalid username or password."="Nom d'utilisateur ou mot de passe incorrect.";
Causes an error. I've tried adding backslashes, but it havn't worked as well.
Using Special Characters in String Resources Just as in C, some
characters must be prefixed with a backslash before you can include
them in the string. These characters include double quotation marks,
the backslash character itself, and special control characters such as
linefeed (\n) and carriage returns (\r).
From:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html
Did you try escaping it with a backslash?
"\'"
As a last resort you could use direct U codes:
You can include arbitrary Unicode characters in a value string by
specifying \U followed immediately by up to four hexadecimal digits.
The four digits denote the entry for the desired Unicode character;
for example, the space character is represented by hexadecimal 20 and
thus would be \U0020 when specified as a Unicode character. This
option is useful if a string must include Unicode characters that for
some reason cannot be typed. If you use this option, you must also
pass the -u option to genstrings in order for the hexadecimal digits
to be interpreted correctly in the resulting strings file. The
genstrings tool assumes your strings are low-ASCII by default and only
interprets backslash sequences if the -u option is specified.
The apostrophe should be \U0027

How can I enter quotes or apostrophes in neo4j

Trying to enter the following text fails:
MERGE (people:People {Person:'Abe N. O'Sullivan'})
Replacing the apostrophe with a ’ works, but I wonder if there is a more ellegant solution.
Use double quotes, and it will work fine:
MERGE (people:People {Person:"Abe N. O'Sullivan"})
Note if this were the name of a property, you can use backticks to escape the name of a property that has spaces or special characters in it. For text literals, you can surround them with either single or double quotes. If you want to put a quote inside of a text literal quote, you either need to use the other kind of quote to surround the string, or you need to escape it with backslash, I believe.

Resources