SCSS Processor Unicode Output Incorrect - unicode

I have tested this issue using Scout-App and Visual Studio Code on Windows 10.
Having just downloaded Font-Awesome 4.7.0 SCSS files and set up a project/workspace, I have noticed a problem with unicode output. As an example:
in the '_variables.scss' partial, we have:
$fa-css-prefix: fa;
$fa-var-music: "\f001";
and in '_icons.scss' partial, we have:
.#{$fa-css-prefix}-music:before { content: $fa-var-music; }
with an expected result of:
.fa-music:before { content: "\f001"; }
but the output is:
.fa-music:before { content: ""; }
So all the unicode values stored in variables are processed to 
Thus I am unable to correctly compile the correct output for a modified font-awesome CSS file.
I have tried placing UTF8 encoding at the top of each SCSS file but the issue is still unresolved.
For a quick test, this will produce the result described:
test.scss
#charset "UTF-8";
$fa-css-prefix: fa;
$fa-var-music: "\f001";
.#{$fa-css-prefix}-music:before { content: $fa-var-music; }

It seems by writing:
"\f0a9" ,
Scout will compile the unicode character.
But, if you use interpolation:
#{'"' + \f0a9 + '"'}
then Scout will compile to "\f0a9".
You can also use variables like
$escaped: \f0aa;
...
#{'"' + $escaped + '"'}
or:
$escaped: f0aa;
...
#{'"\\' + $escaped + '"'}
Remarks:
The compiled unicode character may become a problem to the browser in the content attribute. Therefore you want to give him the written hex code.
If you mess around with the backslash and the interpolation, see also here:
Sass variable interpolation with backslash in output

Related

Issue using Dotnetzip in powershell error consider setting UseZip64WhenSaving

I have used dotnetzip in c# with large files with no problem. I have a requirement to zip up some large files in the power shell. I see from dotnetzip docs I can use it iN ps .
But I keep getting the error
Compressed or Uncompressed size, or offset exceeds the maximum value. Consider setting the UseZip64WhenSaving property on the ZipFile instance.
this is my PS code. How do I set the UseZip64WhenSaving in PS?
[System.Reflection.Assembly]::LoadFrom("D:\\mybigfiles\\Ionic.Zip.dll");
$directoryToZip = "D:\\mybigfiles\\";
$zipfile = new-object Ionic.Zip.ZipFile;
#$zipfile.UseZip64WhenSaving;
$e= $zipfile.AddEntry("mybig.csv", "This is a zipfile created from within powershell.")
$e= $zipfile.AddDirectory($directoryToZip, "home")
$zipfile.Save("D:\\mybigfiles\\big.zip");
$zipfile.Dispose();
Working C# code.
using (ZipFile zip = new ZipFile())
{
zip.UseZip64WhenSaving = Zip64Option.AsNecessary;
zip.AddFile(compressedFileName);
zip.AddFile("\\\\server\\bigfile\\CM_Report_20220411200326.csv");
zip.AddFile("\\\\server\\bigfile\\PM_Report_20220411200326.csv");
zip.AddFile("\\\\server\\bigfile\\SCE_Report_20220411200326.csv");
}```
Unlike C#, PowerShell loves implicit type conversions - and it'll implicitly parse and convert a string value to its cognate enum value when you assign it to an enum-typed property:
$zipfile.UseZip64WhenSaving = 'AsNecessary'
Alternatively, make sure you qualify the enum type name:
#$zipfile.UseZip64WhenSaving = [Ionic.Zip.Zip64Option]::AsNecessary
It's also worth noting that all PowerShell string literals act like verbatim strings in C# - in other words, \ is not a special character that needs to be escaped:
$directoryToZip = "D:\mybigfiles\"
# ...
$e = $zipfile.AddDirectory($directoryToZip, "home")
$zipfile.Save("D:\mybigfiles\big.zip")

How to make my own encoding for a file in VSCode Editor

Is it possible to have an own encoding in VSCode editor, inheritd from an exising?
class myEcoding implements utf-8
{
// changes for some codes
}
I have some files, which contains german characters like "ä ö ü" that are encoded as unicode numbers in this file.
So for example, the file conatins the following line
Pr\u00FCfsignal
While I want to edit this file with the correct german characters, it should exist on the harddisk in the form above.
This is how I want to see it in the editor
Prüfsignal
I already have a function, that can transform a string in both directions:
function translate(content: string, direction: boolean): string {
if (direction) {
content = content
.replace(/\\u00E4/g, "ä")
.replace(/\\u00F6/g, "ö")
.replace(/\\u00FC/g, "ü")
.replace(/\\u00C4/g, "Ä")
.replace(/\\u00D6/g, "Ö")
.replace(/\\u00DC/g, "Ü")
.replace(/\\u00DF/g, "ß")
.replace(/\\u00B0/g, "°")
.replace(/\\u00B1/g, "±")
.replace(/\\u00B5/g, "µ");
}
else {
content = content
.replace(/ä/g, "\\u00E4")
.replace(/ö/g, "\\u00F6")
.replace(/ü/g, "\\u00FC")
.replace(/Ä/g, "\\u00C4")
.replace(/Ö/g, "\\u00D6")
.replace(/Ü/g, "\\u00DC")
.replace(/ß/g, "\\u00DF")
.replace(/°/g, "\\u00B0")
.replace(/±/g, "\\u00B1")
.replace(/µ/g, "\\u00B5");
}
return content;
}
Can this be solved with a custom encoding, and if yes, any hints?
Is there possibly a better solution?
There has been an open feature request for some years to Provide encoding-related APIs for editor extensions:
https://github.com/microsoft/vscode/issues/824
For now you could just wrap that function in a loop that encodes all files in the working directory.

How to define a macro to interpret a unicode character with Mathjax

I have the following markup in my page:
<p>$$\textbf{P} = \left⌊ \frac{\left( \left⌊ \frac{\textbf{A}}{100}\right⌋ \times 8 + 13 \right)}{25}\right⌋ - 5$$</p>
When MathJax tries to render it, I have the following error:
Missing or unrecognized delimiter for \left
I figured that the left floor (⌊) and right floor (⌋) unicode characters are what is not recognized in my expression because when I replace them with \lfloor and \rfloor, it's working properly.
My MathJax configuration is the following:
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$']]
}
};
I've tried to add macros to interpret the unicode characters with the following configuration with no luck:
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$']],
macros: {
"⌊": '{\\lfloor}',
"⌋": '{\\rfloor}'
}
}
};
Knowing that I can't change the markup because I not the one maintaining it and I have no way of changing it, is there a configuration that will allows me to make it work.

Output '{{$NEXT}}' with Text::Template

The NextRelease plugin for Dist::Zilla looks for {{$NEXT}} in the Changes file to put the release datetime information. However, I can't get this to be generated using my profile.ini. Here's what I have:
[GenerateFile / Generate-Changes ]
filename = Changes
is_template = 1
content = Revision history for {{$dist->name}}
content =
;todo: how can we get this to print correctly with a template?
content = {{$NEXT}}
content = initial release
{{$dist->name}} is correctly replaced with my distribution name, but {{$NEXT}} is, as-is, replaced with nothing (since it's not escaped and there is no $NEXT variable in). I've tried different combinations of slashes to escape the braces, but it either results in nothing or an error during generation with dzil new. How can I properly escape this string so that after dzil processes it with Text::Template it outputs {{$NEXT}}?
In the content, {{$NEXT}} is being interpreted as a template block and, as you say, wants to fill itself in as the contents of the missing $NEXT.
Instead, try:
content = {{'{{$NEXT}}'}}
Example program:
use 5.14.0;
use Text::Template 'fill_in_string';
my $result = fill_in_string(
q<{{'{{$NEXT}}'}}>,
DELIMITERS => [ '{{', '}}' ],
BROKEN => sub { die },
);
say $result;

FPDF Converting Apostrophes into Weird Characters

I have this string passed from a JavaScript form:
4 H/M’s
Which gets posted to an array, called '$out' and is keyed by "blurb".
I use FPDF to output it, with MultiCell, like so:
$pdf->MultiCell(190,4,$out["blurb"]);
However, FPDF outputs this string:
4 H/M’s
I've tried
html_entity_decode($out["blurb"], ENT_QUOTES, "UTF-8")
but it doesn't seem to be working. Any suggestions?
Use iconv like this :
// put $str your sting to encode for FPDF
// put $myencoding value as you current encoding
function fpdf_encode($str,$myencoding='latin1') {
return iconv($myencoding, 'windows-1252', trim(utf8_decode($str)));
}