Search code examples
cssasp.netunicodesystem.web.optimization

How can I set the System.Web.Optimization bundler to correctly transform ISO unicode


My CSS:

    #site-heading li:after {
        content: '\2002\2022\2002';
    }

Gets transformed to:

#site-heading li:after{content:'???'}

during the bundling process and I can't figured out how to get it so the content remains a space, bullet, space.


Solution

  • The answer is, you don't set anything within System.Web.Optimization.

    Instead make sure the css file in the bundle is encoded as UTF-8. The @charset "utf-8"; declaration at the top of the file is not enough. The file has to physically be encoded. Pasting a UTF-8 symbol directly in Visual Studio, will casue Visual Studio to question you if you want to save as UTF-8 upon saving the file. Alternatively, using something like Notepad++, one can convert the encoding format from the menu (Encoding -> Convert to UTF-8), then save.

        #site-heading li:after {
            content: ' • ';
        }
    

    This content is then parsed and converted as intended when bundled/minified.