Comments (15)
Not currently; I didn't have time to look into it when we began the project. Is it as simple as using wchar_t? Will I need to rely on a 3rd party library for checking character classes and such?
from libsass.
It is not require any 3rd party libraries to manipulate wchar_t. It is simple as using char. All functions for char is also available for wchar_t.
from libsass.
I believe we intend it. We are noobs.
On Mon, Jul 9, 2012 at 3:50 PM, Igorbek <
[email protected]
wrote:
Internally the project uses 'char' instead of 'wchar_t' for manipulating
strings.
So that means no Unicode support?
Reply to this email directly or view it on GitHub:
#25
from libsass.
There's no need to change to wchar_t
if you pick a nice encoding like UTF-8 and stick with it (which I recommend). GLib uses char
everywhere and only when you specifically need to deal with some Unicode peculiarities do you need to use any other functions.
from libsass.
Thanks, @QuLogic, I would agree with you.
But the library incorrect loads (only ANSII and UTF-8 without BOM encodings) and saves with encoding.
It is still the problem.
from libsass.
I just tried a file with actual UTF-8 characters and it works just fine. But it doesn't have a BOM because it's not necessary in UTF-8. I think all that needs to be done is to ignore the BOM (assuming the code's going to work with UTF-8 only, that is).
from libsass.
I think the problem is not just in encoding. If library interface takes a UTF-8 encoded char*
, I'll convert to it from any encoding.
But, if my code imports some file (via @import
derective), I can't specify the encoding of that file, and the libsass always interpretate it as UTF-8 without BOM.
In some cases, I can't control of the encoding of the files. But I can know what encoding is in every file (by detection algorithms, user settings or transport-specifiec information, in by ex. HTTP Content-Type).
I think the best solution for this is introduce ability to provide some interface, that would be able to resolve file paths and file contents.
Something like this:
class SourceContext
{
public:
virtual std::string get_content() = 0;
virtual std::shared_ptr<SourceContext> resolve_path(std::string path) = 0;
};
from libsass.
Ah, if only everyone just used UTF-8. But yes, I forgot about the @import
issue.
I think if libsass says "I assume UTF-8 everywhere", then we fix up issue #21 nicely (in some way similar to what you propose), libsass could just have the application/bindings deal with the encoding.
from libsass.
Guys, have you decided what do on this? As already mentioned, it breaks with files that include a BOM.
I used to do C++ before I discovered C# and wchar_t was a big pain to use back then because it meant different OS support (I think Unicode was supported after Windows 2000/XP) and you have to use compiler flags to produce ANSI and Unicode versions specifically.
In this day and age when all OSes support Unicode, changing wchar_t should be trivial. The only "problem" is that the memory usage will double automatically - though this is not really a big problem given the size of computer memory and SCSS files.
Let me know what you think.
from libsass.
LibSass will currently read a BOM if present and reject any files that aren't UTF-8.
Aside from that, since we'd like to avoid external dependencies if possible, I'll look into using wchar_t then.
from libsass.
Seriously?? Then it must be because this guy hasn't rebased in 3 months.
Anyhow, this was my fix: TBAPI-0KA#1
from libsass.
If you get stuck anywhere with wchar_t, feel free to comment here and I'll try to help
from libsass.
... should be trivial ...
Famous last words.
from libsass.
LOL. Fair comment but at I least I went for "should" vs "will" :)
from libsass.
LibSass is only going to support UTF-8 for the forseeable future. This support is mostly implemented, and there are tickets for the little edge-cases on which it fails.
from libsass.
Related Issues (20)
- libsass.org has expired HOT 2
- SassError: media query expression must begin with '(' HOT 2
- build with autotools failed on ubuntu16.04
- extend does not extend all values
- 'There are no more files' error with Ruby 2.7..3 & Windows 7 (might be ffi related) HOT 3
- Read null address in Sass::SharedPtr::obj and Sass::Functions::sass_if HOT 2
- Read null address in Sass::Inspect::operator() HOT 1
- Is any precombiled so files for Raspberry ARM64
- can't find stylesheet to import "~@angular/material/theming"; HOT 1
- AddressSanitizer: SEGV on unknown address 0x000000000000 at inspect.cpp:466 HOT 2
- AddressSanitizer: stack-overflow on address 0x7ffff3e46ff8 (pc 0x7f13120dddd5 bp 0x615000000be8 sp 0x7ffff3e47000 T0) HOT 2
- random($limit) should no longer ignore units HOT 1
- A stack-overflow src/ast_selectors.cpp:557 in Sass::CompoundSelector::has_real_parent_ref() const HOT 7
- AddressSanitizer: stack-overflow src/ast_selectors.cpp:464 in Sass::ComplexSelector::has_placeholder() const HOT 2
- LeakSanitizer: detected memory leaks HOT 1
- LibSass not doing inplace text replacement for variables in unknown at rules HOT 2
- Ambiguous operator== overloads with GCC 13 and C++20
- Validated `or` css-operator usage does not compile in media query when included in SCSS HOT 5
- `mix(...)` sass semantics in relation to `color-mix(...)` css semantics HOT 3
- 3.6.6: compile time watnings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsass.