Charset utf 8 ошибка

I am trying to compile my .less document, and I am getting an error when trying to use @charset "UTF-8";.

I want to be sure my document is encoded correctly because of the way I embed my fonts. src: local(‘☺’), url(…);

Any ideas?

BryanH's user avatar

BryanH

5,8263 gold badges34 silver badges47 bronze badges

asked Jul 21, 2010 at 22:23

Dan's user avatar

1

Update:

This seems to be a big, they say to fix it in the next version:

More Info:
https://less.tenderapp.com/discussions/problems/8-charset-error

Thanks for posting, this is fixed in
the upcoming 2.0 version, which should
be released sometime this month. It is
indeed due to @charset not being
parsed as a directive.

That comment by the LESS team was published on:

May 05, 2010 @ 05:50 AM

So it should be fixed in recent version. Make sure that you are using the latest version of it.

answered Jul 21, 2010 at 22:32

Sarfraz's user avatar

SarfrazSarfraz

377k77 gold badges533 silver badges578 bronze badges

try

html {
}
@charset "utf-8";
//your style

answered Feb 17, 2014 at 8:09

chsword's user avatar

chswordchsword

2,03217 silver badges24 bronze badges

0

Try this way:

@charset "UTF-8";

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 15px;
    background-color: #fff;
    color: #6f6f6f;
    font-family: 'Roboto', sans-serif;
    line-height: 24px;
}

cengsemihsahin's user avatar

answered Feb 23, 2022 at 21:15

Arijit Bhattacharjee's user avatar

1

I have a problem with a WCF service.
I have a console application and I need to consume the service without using app.config, so I had to set the endpoint, etc. by code.
I do have a service reference to the svc, but I can’t use the app.config.
Here’s my code:

BasicHttpBinding binding = new BasicHttpBinding();

EndpointAddress address = new EndpointAddress("http://localhost:8731/WcfServicio/MiServicio");

MiServicioClient svc = new MiServicioClient(binding, address);
object ob = svc.PaisesObtener();

At the last line when I do svc.PaisesObtener() I get the error:

Content Type text/xml; charset=utf-8 was not supported by service
http://localhost:8731/WcfServicio/MiServicio.  The client and service bindings may be mismatched.

Boiethios's user avatar

Boiethios

38.6k19 gold badges134 silver badges183 bronze badges

asked Nov 23, 2011 at 23:00

user1055483's user avatar

0

First Google hit says:

this is usually a mismatch in the client/server bindings, where the message version in the service uses SOAP 1.2 (which expects application/soap+xml) and the version in the client uses SOAP 1.1 (which sends text/xml). WSHttpBinding uses SOAP 1.2, BasicHttpBinding uses SOAP 1.1.

It usually seems to be a wsHttpBinding on one side and a basicHttpBinding on the other.

answered Nov 23, 2011 at 23:06

CodeCaster's user avatar

CodeCasterCodeCaster

148k23 gold badges219 silver badges273 bronze badges

9

Do not forget check the bindings-related code too.
So if you wrote:

BasicHttpBinding binding = new BasicHttpBinding();

Be sure that all your app.config files contains

<endpoint address="..."
          binding="basicHttpBinding" ...

not the

<endpoint address="..."
          binding="wsHttpBinding" ...

or so.

answered Feb 21, 2012 at 20:58

mykola.rykov's user avatar

1

I’ve seen this behavior today when the

   <service name="A.B.C.D" behaviorConfiguration="returnFaults">
        <endpoint contract="A.B.C.ID" binding="basicHttpBinding" address=""/>
    </service>

was missing from the web.config. The service.svc file was there and got served. It took a while to realize that the problem was not in the binding configuration it self…

answered Jun 20, 2013 at 18:26

rene's user avatar

renerene

41.5k78 gold badges114 silver badges152 bronze badges

0

I saw this problem today when trying to create a WCF service proxy, both using VS2010 and svcutil.

Everything I’m doing is with basicHttpBinding (so no issue with wsHttpBinding).

For the first time in my recollection MSDN actually provided me with the solution, at the following link How to: Publish Metadata for a Service Using a Configuration File. The line I needed to change was inside the behavior element inside the MEX service behavior element inside my service app.config file. I changed it from

<serviceMetadata httpGetEnabled="true"/>  

to

<serviceMetadata httpGetEnabled="true" policyVersion="Policy15"/>

and like magic the error went away and I was able to create the service proxy. Note that there is a corresponding MSDN entry for using code instead of a config file: How to: Publish Metadata for a Service Using Code.

(Of course, Policy15 — how could I possibly have overlooked that???)

One more «gotcha»: my service needs to expose 3 different endpoints, each supporting a different contract. For each proxy that I needed to build, I had to comment out the other 2 endpoints, otherwise svcutil would complain that it could not resolve the base URL address.

Hakan Fıstık's user avatar

Hakan Fıstık

16.9k14 gold badges111 silver badges131 bronze badges

answered Apr 24, 2015 at 18:21

D. Diamond's user avatar

I was facing the similar issue when using the Channel Factory. it was actually due to wrong Contract specified in the endpoint.

answered May 5, 2016 at 13:51

Sumit Agrawal's user avatar

For anyone who lands here by searching:

content type ‘application/json; charset=utf-8’ was not the expected type ‘text/xml; charset=utf-8

or some subset of that error:

A similar error was caused in my case by building and running a service without proper attributes. I got this error message when I tried to update the service reference in my client application. It was resolved when I correctly applied [DataContract] and [DataMember] attributes to my custom classes.

This would most likely be applicable if your service was set up and working and then it broke after you edited it.

Racil Hilan's user avatar

Racil Hilan

24.7k13 gold badges50 silver badges55 bronze badges

answered Jul 18, 2016 at 22:36

Corey's user avatar

CoreyCorey

213 bronze badges

1

I was also facing the same problem recently. after struggling a couple of hours,finally a solution came out by addition to

Factory="System.ServiceModel.Activation.WebServiceHostFactory"
to your SVC markup file. e.g.
ServiceHost Language="C#" Debug="true" Service="QuiznetOnline.Web.UI.WebServices.LogService" 
Factory="System.ServiceModel.Activation.WebServiceHostFactory" 

and now you can compile & run your application successfully.

HaveNoDisplayName's user avatar

answered May 26, 2015 at 15:08

Anver Sadat's user avatar

Again, I stress that namespace, svc name and contract must be correctly specified in web.config file:

 <service name="NAMESPACE.SvcFileName">
    <endpoint contract="NAMESPACE.IContractName" />
  </service>

Example:

<service name="MyNameSpace.FileService">
<endpoint contract="MyNameSpace.IFileService" />
</service>

(Unrelevant tags ommited in these samples)

answered Oct 3, 2016 at 11:49

alexkovelsky's user avatar

alexkovelskyalexkovelsky

3,8801 gold badge27 silver badges21 bronze badges

In my case, I had to specify messageEncoding to Mtom in app.config of the client application like that:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="IntegrationServiceSoap" messageEncoding="Mtom"/>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:29495/IntegrationService.asmx"
                binding="basicHttpBinding" bindingConfiguration="IntegrationServiceSoap"
                contract="IntegrationService.IntegrationServiceSoap" name="IntegrationServiceSoap" />
        </client>
    </system.serviceModel>
</configuration>

Both my client and server use basicHttpBinding.
I hope this helps the others :)

answered May 23, 2018 at 7:14

Mehmet Recep Yildiz's user avatar

I had this error and all the configurations mentioned above were correct however I was still getting «The client and service bindings may be mismatched» error.

What resolved my error, was matching the messageEncoding attribute values in the following node of service and client config files. They were different in mine, service was Text and client Mtom. Changing service to Mtom to match client’s, resolved the issue.

<configuration>
  <system.serviceModel>
      <bindings>
           <basicHttpBinding>
              <binding name="BasicHttpBinding_IMySevice" ... messageEncoding="Mtom">
              ...
              </binding>
           </basicHttpBinding>
      </bindings>
  </system.serviceModel>
</configuration>

answered Jun 29, 2020 at 9:58

SouthSun's user avatar

SouthSunSouthSun

791 silver badge3 bronze badges

I had this problem in .net 6.0

The problem was the Soap Version, the BasicHttpBinding targets Soap 1.1 by default, but the service uses Soap 1.2.

The solution was to create a custom binding that targets Soap 1.2:

private Binding GetBindingConfiguration()
{
    var textBindingElement = new TextMessageEncodingBindingElement()
    {
        MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
    };

    var httpsBindingElement = new HttpsTransportBindingElement()
    {
        MaxReceivedMessageSize = int.MaxValue,
        RequireClientCertificate = true //my service require certificate
    };

    return new CustomBinding(textBindingElement, httpsBindingElement);
}

var binding = GetBindingConfiguration();
var address = new EndpointAddress("https://nfe.sefa.pr.gov.br/nfe/NFeAutorizacao4"); //Brazil NF-e endpoint that I had to consume.

var svc = new MyService(binding, address);

//my service requires certificate
svc.ClientCredentials.ClientCertificate.Certificate = certificado; 

object ob = svc.PaisesObtener(); //call the method

answered Jan 23 at 20:30

fsbflavio's user avatar

fsbflaviofsbflavio

67410 silver badges22 bronze badges

Actually, this is my whole main fn (simplified):

fun main(args: Array<String>) {
    val pdfContentType = ContentType("application", "pdf")

    embeddedServer(Netty, port = getPort()) {
        install(DefaultHeaders)
        install(CallLogging)
        install(CORS) {
            anyHost()
        }
        install(ContentNegotiation) {
            register(ContentType.Application.Json, JacksonConverter())
        }
        routing {
            post("/") {
                val task = call.receive<Task>()

                worker.load().use {
                    execTask(it, task)

                    val stream = ByteArrayOutputStream()
                    it.save(stream)

                    call.respond(Content(
                        bytes = stream.toByteArray(),
                        contentType = pdfContentType
                    ))
                }
            }
        }
    }.start(wait = true)
}

The error I have occurs deep in the execTask, and the issue there is that Task (a data-class object) have stings that are not encoded in the UTF-8 (if I pass application/json as a Content-Type).
However, when I pass application/json; charset=utf-8 as a Content-Type, the resulting Task has strings in valid UTF-8 encoding (no error occurs).

Note that the resulting strings with incorrect encoding seem to be binary the same — they’re just getting interpreted incorrectly. This applies to multi-byte characters (Cyrillic symbols in my case).

Effectively I get the following error (it’s not from ktor, but it might help understand what the issue with encoding is): java.lang.IllegalArgumentException: No glyph for U+0081 in font LiberationSans.
The character that causes an error in this case should be U+0441 (https://www.compart.com/en/unicode/U+0441). It was supposed to be in the string (instead of, I guess, U+00D1 U+0081).

  • Created
  • Category
    Uncategorized

OpenCart is an opensource ecommerce CMS. When dealing with OpenCart, you may encounter the error below

Warning: html_entity_decode(): charset `UTF-8;' not supported, assuming utf-8 in /home/givehydr/preddime.com/catalog/controller/extension/module/ocslideshow.php on line 31

Normally, a warning like this one can be safely ignored by turning off error display in Multi PHP INI Editor in cPanel.

But this move does not resolve the error.

Other solutons that don’t resolve the error are:

  • Turning off display errors in OpenCart index.php file
  • Turning off Error dosplay n .htaccess file
  • Changing the php version to a higher or lower onne

Solution

The solution to this error lies in the syntax of the web server directive in .htaccess file, php.ini or user.ini. To resolve, access your document root and open the .htaccess file. Look for the line below

php_value default_charset "UTF-8;"

and remove the ‘;’ symbol at the end of UTF-8 so that the new line looks like below

php_value default_charset "UTF-8"

Was this article helpful?

Проблемы с кодировкой на сайте

Проблемы с кодировкой на сайте

Одной из самых частых проблем, с которой сталкивается начинающий Web-мастер (да и не только начинающие), это проблемы с кодировкой на сайте. Даже у меня постоянно появляется при создании сайтов «абракадабра«. Но, благо, я прекрасно знаю, как эту проблему решить, поэтому всё привожу в порядок в течение нескольких секунд. И в этой статье я постараюсь научить Вас также быстро решать проблемы, связанные с кодировкой на сайте.

Первое, что стоит отметить, это то, что все проблемы с появлением «абракадабры» связаны с несовпадением кодировки документа и кодировки, выставляемой браузером. Допустим, документ в windows-1251, а браузер почему-то выставляет UTF-8. А уже источником такого несовпадения могут быть следующие причины.

Первая причина

Неправильно прописан мета-тег content-type. Будьте внимательны, в нём всегда должна находиться та кодировка, в котором написан Ваш документ.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Вторая причина

Вроде бы, мета-тег прописан так, как Вы хотите, и браузер выставляет именно то, что Вы хотите, но почему-то всё равно с кодировкой проблемы. Здесь, почти наверняка, виновато то, что сам документ имеет отличную кодировку. Если Вы работаете в Notepad++, то внизу справа есть название кодировки текущего документа (например, ANSI). Если Вы ставите в мета-теге UTF-8, а сам документ написан в ANSI, то сделайте преобразование в UTF-8 (через меню «Кодировки» и пункт «Преобразовать в UTF-8 без BOM«).

Третья причина

Мета-тег написан правильно, кодировка документа верная, но браузер почему-то настойчиво выбирает другую кодировку. Это уже связано с настройками сервера. Способ решения данной проблемы можно прочитать здесь: как задать кодировку в htaccess.

Четвёртая причина

И, наконец, последняя популярная причина — это проблема с кодировкой в базе данных. Во-первых, убедитесь, что все Ваши таблицы и поля написаны в одной кодировке, которая совпадает с кодировкой остального сайта. Если это не помогло, то сразу после подключения в скрипте выполните следующий запрос:

SET NAMES 'utf8'

Вместо «utf8» может стоять другая кодировка. После этого все данные из базы должны выходить в правильной кодировке.

В данной статье я, надеюсь, разобрал, как минимум, 90% проблем, связанных с появлением «абракадабры» на сайте. Теперь Вы должны расправляться с такой популярной и простой проблемой, как неправильная кодировка, в два счёта.

  • Создано 21.05.2012 13:43:04


  • Михаил Русаков

Копирование материалов разрешается только с указанием автора (Михаил Русаков) и индексируемой прямой ссылкой на сайт (http://myrusakov.ru)!

Добавляйтесь ко мне в друзья ВКонтакте: http://vk.com/myrusakov.
Если Вы хотите дать оценку мне и моей работе, то напишите её в моей группе: http://vk.com/rusakovmy.

Если Вы не хотите пропустить новые материалы на сайте,
то Вы можете подписаться на обновления: Подписаться на обновления

Если у Вас остались какие-либо вопросы, либо у Вас есть желание высказаться по поводу этой статьи, то Вы можете оставить свой комментарий внизу страницы.

Если Вам понравился сайт, то разместите ссылку на него (у себя на сайте, на форуме, в контакте):

  1. Кнопка:

    Она выглядит вот так: Как создать свой сайт

  2. Текстовая ссылка:

    Она выглядит вот так: Как создать свой сайт

  3. BB-код ссылки для форумов (например, можете поставить её в подписи):

Понравилась статья? Поделить с друзьями:

Интересное по теме:

  • Chevrolet cruze ошибка подушки безопасности
  • Charles ошибка 25294
  • Chevrolet cruze ошибка номер 89
  • Channel получено следующее предупреждение о неустранимой ошибке 70
  • Chaffoteaux ошибка sp3 на котле

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии