w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
String.getBytes(charset) has errors for EBCDIC-charset
When you call data.getBytes(ebcdic) You are encoding the text in data into EBCDIC bytes. Then you create a string from these bytes as if they stood for some string in the default character encoding for your system: this causes breakage because the bytes don't have to encode valid text in any other encoding than EBCDIC. To fix this, keep bytes as bytes: byte[] result= data.getBytes(ebcdic); System.out.printf("EBCDIC: %s ",asHex(result));

Categories : Java

the content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'
You need to use the WebServiceHostFactory, instead of the regular ServiceHostFactory in your code. That will configure the endpoint with the appropriate binding (webHttpBinding) and behavior (webHttp) to honor the [WebInvoke] attribute. <serviceHostingEnvironment > <serviceActivations> <add factory="System.ServiceModel.Activation.WebServiceHostFactory" relativeAddress="./wsccc1/wscccService.svc" service="service.wservice"/> </serviceActivations> </serviceHostingEnvironment>

Categories : Json

Problem to plot 3D surface with R‏
Try this to see why I don't think this data is well suited for wireframe: cloud(Z~X+Y, data=FI02, xlab="X", ylab="Y", main="Surface elevation", type="l", screen=list(z=-60, x=-60))

Categories : R

kruskal.test shows "All group levels must be finite" error. What is the problem?
It should work if you run data$Grp <- as.factor(data$Grp) Then (as before): kruskal.test(data$Val, data$Grp) This is because Grp is a character not a factor and is.finite applied to an object of character class is always false (see ?is.finite).

Categories : R

Need of charset in PDO
I just want to know why I need charset if it doesn't show any error. If it doesn't - well, you don't need then. what is the correct format. Correct one would be to add ;charset=utf8 to your $connstr. But as it wont't work on the earlier versions, init command could be used just in case.

Categories : Mysql

What charset encoding for an API
The C# client should send all parameters encoded in UTF8. You cannot run way from Unicode - UTF8 in JSON since the definition of JSON states: JSON text SHALL be encoded in Unicode. The default encoding is UTF-8. It could also be UTF-16 (BE or LE) or UTF-32 (BE or LE). If you generate JSON from the data and then get the hmac there should be a difference, right? Since at the least JSON has two more symbols? { or } so should the hash be different than the one sent by the C# Client? Either have the client send you the data in JSON or get the hmac before converting the data.

Categories : C#

PDO and Mysql charset
Just don't bother. As a matter of fact, utf-8 use exactly the same escaping rules as default latin1. So, it wouldn't mess up thing with the escape functions. Not to mention that you shouldn't use them manually at all (though they are used silently in emulation mode). As long as you are using utf-8 for your sites, just keep charset in DSN and put $PDO->exec("SET NAMES utf8"); for compatibility and you will have all the possible cases covered. Another thing on "messing with escape functions" is that you can turn emulation mode off, and thus, as long as you are using placeholders to represent your data in the query, $conn->setAttribute( PDO::ATTR_EMULATE_PREPARES, false ); no escaping would be involved ever. - so, there would be no point to worry at all.

Categories : PHP

XMLHttpRequest charset
As far as I remember, the default charset for XMLHttpRequest is utf-8, which you can (and should) use to send Hebrew. However, you can set the charset encoding yourself with: xmlhttp.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");

Categories : PHP

Correct charset for |
It looks like your thermal printer is configured to use one of the ancient character encodings where "uncommon" characters - brackets, braces, vertical bar, .... - are replaced by "national characters," for example ä, ö ü and ß in Germany. When the device is set to use these encodings there is no way to output the replaced characters. Have a look at the user manual for the thermal printer. There must be a way to change the character mapping to standard ASCII. The Linux console for example has the escape code "33(B" to return to the usual ASCII encoding.

Categories : Java

Is it possible to specify charset for an element?
It is impossible to do this. It is also difficult to design a way for this to work even theoretically. Think about it: the browser already parses your syntax using the charset. Considering implicit tag closing rules in HTML making this work would be difficult indeed. What you can do is include an IFrame with a completely different document using a different charset. To understand this limitation even better the meta http-equiv elements are not even part of the HTML document architecturally. Rather they are another way to specify HTTP headers if you cannot do it in HTTP server configuration.

Categories : CSS

Having trouble finding why I can't set charset to UTF-8 in php
I always used this and worked fine. Try it also without single quotes (I can't see the code now): mysql_query("SET NAMES 'utf8'"); Edit mysql_set_charset() doesn't throw exceptions. It is procedural style. You will find errors by mysql_error(). Note That Using mysql_set_charset is the preferred way to change the charset. Using mysql_query() to set it (such as SET NAMES utf8) is not recommended. Also, using mysqli_set_charset is prefered, as mysql_set_charset is deprecated from PHP 5.5.0. So, don't use mysql_query to set charset, nor use mysql_set_charset. Use instead mysqli_set_charset!

Categories : PHP

What should I import to be able to use CharSet.Unicode?
It presents under the System.Runtime.InteropServices namespace under the assembly mscorlib (in mscorlib.dll). More details you can find in MSDN.

Categories : Vb.Net

PHP - charset for variables and include
It does not make any difference whether you include files or echo text. PHP does not do any encoding conversion or handle encodings in any way in these operations. All it does is output the raw text as found in the source code directly, unaltered. If text from one file works and from another doesn't, that means those files are differently encoded. Save them in the same encoding in your text editor. Possibly you are outputting a different Content-Type header in these two files, as HTML tag or otherwise. Check for that remote possibility. See What Every Programmer Absolutely, Positively Needs To Know About Encodings And Character Sets To Work With Text and Handling Unicode Front To Back In A Web App if you need more information.

Categories : PHP

Javascript file charset in ASP.NET 4
This is probably a "problem" with the way the file is saved. It is probably saved as UTF-8 "with signature" and the browser is trying to interpret it as such, when you not set the charset attribute. The page is probably not UTF-8, so, there is a mismatch. Try to save this as "Wester European (Windows)" encoding - this should be a simple ASCII text file then. To do this in VS go to "Save As" dialog and select "Save with Encoding". Or, it could be the other way around, but definitely it looks like there is a mismatch between the page encoding and the JS file encoding.

Categories : Asp Net Mvc

NIO2 and charset used in channels
As you can see from your code you are reading bytes from a FileChannel. How you will interpret those bytes is up to you. In your code the read bytes are converted to a string when you do System.out.print((char) buf.get());. This is why you see that output. Try to create explicitly a new String using the contructor that specifies the desired character set i.e. String(byte[] bytes, Charset charset)

Categories : Java

PHP Charset for special characters
chances are your mySQL database table is not in the correct collation. ALTER TABLE `posts` CHANGE `content` `content` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ; do a change like this for your entire database, table, or cell.

Categories : PHP

Header Content Type Charset UTF-8 with BOM
There's absolutely no need to include a BOM in an HTML file. (If it really includes different encodings, then a UTF-8 BOM would be broken, so it sounds like you're a bit confused.) If you expect the file to be saved to disk and used in places where UTF-8 isn't expected, you could add a meta element to indicate the encoding as well: <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> If in fact you are using a different encoding than UTF-8, then rather than a BOM, just change the value in the meta attribute. If you really must have a BOM in there then you'll need to make sure that it's first thing you output, e.g. echo "xEFxBBxBF"; See How can I output a UTF-8 CSV in PHP that Excel will read properly? for an example where that actually makes sense.

Categories : PHP

Magento issue with email charset
kristoff, I had the same issue before with Portuguese, which also has special characters. I've sorted it out by using the function htmlentities() for accented words. The Zend Mail Object is a bit retarded. I hope it helps.

Categories : Magento

$code .= mb_substr($this->charset, $rnum, 1,'UTF-8');
mbstring functions is not enabled by default, you need to compile PHP with mbstring support (or install a package that has mbstring support). More info: http://es1.php.net/manual/en/mbstring.installation.php

Categories : PHP

Ajax sends wrong charset
do you use an external javascript file for this?, I think you need also to set the character set for the inclusion of the javascript file <script src="myscripts.js" charset="latin2"></script> but I really recommend you to use UTF-8 both on server and client side scripts

Categories : PHP

Php Charset error(I guess) - Zen cart
Make sure your default MYSQL and PHP language is also set to UTF-8. If you don't have access to your php.ini I found manually setting the Mysql language in my php script fixed it for me, check out this command http://php.net/manual/en/mysqli.set-charset.php $mysqli->set_charset("utf8"); should fix your problem.

Categories : PHP

convert charset in windows and linux
It seems the encoding of the output is controlled by the encoding of the source file. Unless specified at compile time (How can I specify the encoding of Java source files?), the default encoding is inherited from the OS. I am guessing the Windows machine you used had a default encoding that caused the output you are expecting, while the Linux machine did not. See this question for a similar issue reported - Charset of Java source file and failing test. I was able to reproduce the behavior. Also found a fix - changing the encoding of the source file. Read on for details. I ran the following code in two different encodings. System.out.println(Charset.defaultCharset().toString()); byte[] data = new byte[] {9, 22, 9, 65, 9, 54, 9, 22, 9, 44, 9, 48, 9, 64}; System.out.println(Arrays.toStri

Categories : Java

glade and pygtk (probably a charset prob?)
 is a backspace character, AFAIR; you should escape the backslash: >>> print "C:lubb.glade" Clubb.glade >>> print "C:\blubb.glade" C:lubb.glade

Categories : Python

Convert string to correct charset
Use decode and encode methods for str type. for example : x = "this is a test" # ascii encode x = x.encode("utf-8") # utf-8 encoded x = x.decode("utf-8") # ascii encoded

Categories : Python

Android byte to string charset
The UTF-8 bytes for ő are c5 91. As Log.v(TAG, new String(new byte[] { (byte) 0xc5, (byte) 0x91 }, "UTF-8")); outputs ő I think you looked in the wrong place for the problem. It's coming from somewhere else, like reading the udp message maybe.

Categories : Java

convert charset X to unicode in Java
there was no indication that I should delete my question, thus I'm writing my final comment as the answer I was misinterpreting the incoming hex-digits. they were in a specific charset and not uni-code, so they represented the hex-values of a character in that charset. What I'm doing now is new String(byteArray, "CharsetName"); and get (int)s.charAt(i) to get the unicode value and write it to HTML. thanks for your ideas and hints for more details see this answer here: http://stackoverflow.com/a/4049781/1338732 , and this question here: How to convert UTF-8 to unicode in Java?

Categories : Java

Charset UTF-8 not working on
I would recommend usging a framework like Swift Mailer to send the email messages, instead of creating your own email headers. That might solve the charset problem as well. http://swiftmailer.org/

Categories : PHP

charset conversion in mule3 service
Mule uses UTF-8 as its default encoding, unless specified otherwise via the mule.encoding system property at start-up. So the Jersey service running in Mule should use the same encoding, unless the HTTP request specifies it differently with a Accept-Charset header.

Categories : Java

Discover the charset from foreign database
You appear to have UTF-8 data that was treated as Windows-1252 and subsequently converted to UTF-8 (sometimes referred to as "double-encoding"). The first thing that you need to determine is at what stage the conversion took place: before the data was saved in the table, or upon your attempts to retrieve it? The easiest way is often to SELECT HEX(the_column) FROM the_table WHERE ... and manually inspect the byte-encoding as it is currently stored: If, for the data above, you see C397C2A9... then the data is stored erroneously (an incorrect connection character set at the time of data insertion is the most common culprit); it can be corrected as follows (being careful to use data types of sufficient length in place of TEXT and BLOB as appropriate): Undo the conversion from Windows-125

Categories : PHP

HTML meta charset not working
Because either: You have an HTTP header which specifies a different character encoding (HTTP headers take priority over meta elements) or You haven't saved the document using UTF-8 (you are just telling the browser that you are)

Categories : HTML

getting a substring(charset independent) between given two offsets
You can use regular expressions: $string = "This is their cat with a hat in the theater"; $regex1 = "/.*? is |^is/"; $regex2 = "/ the .*| the$/"; echo preg_replace($regex1, '', preg_replace($regex2, ' the', $string)); EDIT Here is more generic code: function find($text, $str, $offset) { $len = strlen($text); $search_len = strlen($str); $count = 0; for ($i=0; $i<$len; ++$i) { if (substr($text, $i, $search_len) == $str) { if (++$count == $offset) { return $i; } } } return -1; } function between($text, $word1, $offset1, $word2, $offset2) { $start = find($text, $word1, $offset1); $end = find($text, $word2, $offset2); if ($start != -1 && $end != -1) { return substr($text, $start

Categories : PHP

MySQL convert charset issue
All right! So this is what must have happened: user interface (UTF-8) → controller (UTF-8) → model (ISO-8859-1) → Database (UTF-8, but it receives ISO-8859-1) So the fields were configured to use the UTF-8 encoding, but they receive ISO-8859-1 encoded data. I wanted to convert the incorrectly encoded data to UTF-8. Since the data was in fact ISO-8559-1 encoded, I resolved my problem with the following little MySQL "hack": UPDATE `table` SET `column` = convert(cast(convert(`column` using latin1) as binary) using utf8) Courtesy ABS on StackOverflow. Thank you for your time looking into my problem, guys! :)

Categories : PHP

How can I change the encoding/charset of a string on Javascript?
From https://developer.mozilla.org/en-US/docs/Web/API/element.innerHTML Note: If a , , or node has a child text node that includes the characters (&), (<), or (>), innerHTML returns these characters as &amp, &lt and &gt respectively. Use Node.textContent to get a correct copy of these text nodes' contents. document.getElementsByTagName("pre")[0].textContent; See: https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent

Categories : Javascript

How to set postgresql client charset using PHPs PDO layer?
I found possibilities of how to set client charset in documentation and it seems followed query works fine: SET NAMES 'WIN1250';

Categories : PHP

Html.BeginRouteForm accept-charset attribute
Use an underscore in the property name: accept_charset MVC automatically convert underscores in html attribute properties to dashes: @using (Html.BeginRouteForm("foo", new { controller = "foo", action = "bar" }, FormMethod.Post, new { id="foo", enctype="multipart/form-data", accept_charset="utf-8" })) { <label for="file">File</label> <input type="file" name="file" id="file" /> <input type="submit" value="Send"/> } Credit: How to use HTML-5 data-* attributes in ASP.NET MVC

Categories : C#

appended html to the dom doesn't respect the charset
This works fine in a fiddle. http://jsfiddle.net/HjCpp/ var html = '<div class="right-item-container"><a href="#"><span style="font-size:24px;" class="item-friend-name">Mamá</span></a><br/><a href="#"><span class="clubName-container">school</span></a></div>'; $('#test').html(html); So it must be the way your original content is encoded.

Categories : Javascript

declares encoding of own file?
Until this element is read, the document is interpreted with the default encoding of the user agent. If the encoding is different from the default, then the document is re-interpreted according to the meta element. That's why you should place it as early as possible, or preferably use an HTTP header (see below). The hope with the <meta> element is that the preceding characters are all in the ASCII character set, which are interpreted correctly in just about all character sets. In general, however, and if it is possible, this information should be sent in an HTTP response header: Content-Type: text/html; charset=utf-8 This ensures that the document is interpreted correctly from the start.

Categories : HTML

What charset should I use for storing emails in a MySQL database?
RFC 6530 allows non-ASCII characters so if you need to plan ahead better choice would be UTF-8. BTW I never saw an e-mail address with non-ASCII characters so it's probably safe to use latin1:) EDIT: As wikipedia states, these are all valid addresses according to RFC 6530: Pelé@example.com (Latin Alphabet (with diacritics)) δοκιμή@παράδειγμα.δοκιμή (Greek Alphabet) 甲斐@黒川.日本 (Japanese Characters) чебурашка@ящик-с-апельсинами.рф (Cyrillic Characters)

Categories : Mysql

perl cgi print header charset not work
This works for me: use CGI; my $q = CGI->new(); print $q->header(-charset => 'big5'); print '簡體字'; When i try it, it will be showed correctly. (Make sure, that your script is also saved in big5).

Categories : Perl

simplexml_load_string not parsing my XML string. Charset issue?
You've been fooled (and had me fooled) by the oldest trick in the SimpleXML book: SimpleXML doesn't parse the whole document into a PHP object, it presents a PHP API to an internal structure. Functions like var_dump can't see this structure, so don't always give a useful idea of what's in the object. The reason it looks "empty" is that it is listing the children of the root element which are in the default namespace - but there aren't any, they're all in the "soapenv:" namespace. To access namespaced elements, you need to use the children() method, passing in the full namespace name (recommended) or its local prefix (simpler, but could be broken by changes in the way the file is generated the other end). To switch back to the "default namespace", use ->children(null). So you could g

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.