Sponsored Content
Top Forums Shell Programming and Scripting Change Hex character strings to HTML entities Post 302412473 by soleil4716 on Monday 12th of April 2010 04:32:25 PM
Old 04-12-2010
Why is this line treated differently?

Code:
data.menu.WorkWeekProfile=<li>&#x5E73;&#x65E5;&#x30D7;<b>&#x30ED;&#x30D5;</b>&#x30A3;&#x30FC;&#x30EB;</li><br />

I see that you added additional <li> and <b> tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Looking for a hex character?

Hi guys , i would want to count the concurrences of the 0A hex char in a text file , then if no matches i need to add a 0A at the end of the line. Any ideas? thx.Regards (1 Reply)
Discussion started by: Klashxx
1 Replies

2. UNIX for Dummies Questions & Answers

How do I get past an HTML::entities discrepancy on an RPM?

I have an RPM that I am trying to install and it keeps coming back with: I know I could kill the bird by throwing a "yum install *perl*" at it, but this seems like hurling a skyscraper at an ant... any better suggestions? (2 Replies)
Discussion started by: jjinno
2 Replies

3. UNIX for Dummies Questions & Answers

delete newline character between html tags

Hi, I have learned some of the Unix commands a way back and not sure of how to code them when needed in certain way, especially sed command. Here is my situation. I have an xml file with several tags. most of the tags start on the same line and end on the same line. However, data for some tags... (8 Replies)
Discussion started by: girish312
8 Replies

4. UNIX for Advanced & Expert Users

Convert UTF-8 encoded hex value to a character

Hi, I have a non-ascii character (Ŵ), which can be represented in UTF-8 encoding as equivalent hex value (\xC5B4). Is there a function in unix to convert this hex value back to display the charcter ? (10 Replies)
Discussion started by: sumirmehta
10 Replies

5. UNIX for Dummies Questions & Answers

Help to replace character strings

Hello Can Any1 help me. I want to replace a specific character string inside a file at a specific location with a particular character with the help of a command or a shell script. The tr command replaces a specific character with another for all the occurences of that character in the file. I... (5 Replies)
Discussion started by: rahulrathod
5 Replies

6. UNIX for Dummies Questions & Answers

Getting strings before and after a character

OK This one has me stumped. I have the following line, program name - the program description that can also contain a hyphen - character. I'm need to separate the "program name" from the program description. I've tried using an array function with the - as delimiter, but I ran into a... (2 Replies)
Discussion started by: ricksj
2 Replies

7. Programming

After converting the hexstr to Hex and storing the Hex in a char*

Hi All, My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ',' This has to be done for all the hexstring char* is NULL. Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies

8. UNIX for Dummies Questions & Answers

character-by-character comparison of strings

This might be a dummy question, but is there a command in UNIX that compare two strings character-by-character and display the difference? ---------- Post updated at 11:25 AM ---------- Previous update was at 10:32 AM ---------- Or probably what I'm looking is how to break a string into... (3 Replies)
Discussion started by: Orbix
3 Replies

9. Programming

What is the difference between ios::hex and std::hex?

Hi, Is there really a difference between these two, std::hex and ios::hex?? I stumbled upon reading a line, "std::ios::hex is a bitmask (8 on gcc) and works with setf(). std::hex is the operator". Is this true? Thanks (0 Replies)
Discussion started by: royalibrahim
0 Replies

10. Shell Programming and Scripting

Extract expressions between two strings in html file

Hello guys, I'm trying to extract all the expressions between the following tags: <b></b> from a HTML file. This is how it looks: big lines containing several dozens expressions (made of 1,2,3,4,6 or even 7 words) I would like to extract: <b>bla ble</b>bla ble</td><tr valign="top"><td... (3 Replies)
Discussion started by: bobylapointe
3 Replies
HTML::Entities(3pm)					User Contributed Perl Documentation				       HTML::Entities(3pm)

NAME
HTML::Entities - Encode or decode strings with HTML entities SYNOPSIS
use HTML::Entities; $a = "V&aring;re norske tegn b&oslash;r &#230res"; decode_entities($a); encode_entities($a, "200-377"); For example, this: $input = "vis-a-vis Beyonce's naieve papier-mache resume"; print encode_entities($input), " " Prints this out: vis-&agrave;-vis Beyonc&eacute;'s na&iuml;ve papier-m&acirc;ch&eacute; r&eacute;sum&eacute; DESCRIPTION
This module deals with encoding and decoding of strings with HTML character entities. The module provides the following functions: decode_entities( $string, ... ) This routine replaces HTML entities found in the $string with the corresponding Unicode character. Unrecognized entities are left alone. If multiple strings are provided as argument they are each decoded separately and the same number of strings are returned. If called in void context the arguments are decoded in-place. This routine is exported by default. _decode_entities( $string, \%entity2char ) _decode_entities( $string, \%entity2char, $expand_prefix ) This will in-place replace HTML entities in $string. The %entity2char hash must be provided. Named entities not found in the %entity2char hash are left alone. Numeric entities are expanded unless their value overflow. The keys in %entity2char are the entity names to be expanded and their values are what they should expand into. The values do not have to be single character strings. If a key has ";" as suffix, then occurrences in $string are only expanded if properly terminated with ";". Entities without ";" will be expanded regardless of how they are terminated for compatibility with how common browsers treat entities in the Latin-1 range. If $expand_prefix is TRUE then entities without trailing ";" in %entity2char will even be expanded as a prefix of a longer unrecognized name. The longest matching name in %entity2char will be used. This is mainly present for compatibility with an MSIE misfeature. $string = "foo&nbspbar"; _decode_entities($string, { nb => "@", nbsp => "xA0" }, 1); print $string; # will print "foo bar" This routine is exported by default. encode_entities( $string ) encode_entities( $string, $unsafe_chars ) This routine replaces unsafe characters in $string with their entity representation. A second argument can be given to specify which characters to consider unsafe. The unsafe characters is specified using the regular expression character class syntax (what you find within brackets in regular expressions). The default set of characters to encode are control chars, high-bit chars, and the "<", "&", ">", "'" and """ characters. But this, for example, would encode just the "<", "&", ">", and """ characters: $encoded = encode_entities($input, '<>&"'); and this would only encode non-plain ascii: $encoded = encode_entities($input, '^ x20-x25x27-x7e'); This routine is exported by default. encode_entities_numeric( $string ) encode_entities_numeric( $string, $unsafe_chars ) This routine works just like encode_entities, except that the replacement entities are always "&#xhexnum;" and never "&entname;". For example, "encode_entities("rxF4le")" returns "r&ocirc;le", but "encode_entities_numeric("rxF4le")" returns "r&#xF4;le". This routine is not exported by default. But you can always export it with "use HTML::Entities qw(encode_entities_numeric);" or even "use HTML::Entities qw(:DEFAULT encode_entities_numeric);" All these routines modify the string passed as the first argument, if called in a void context. In scalar and array contexts, the encoded or decoded string is returned (without changing the input string). If you prefer not to import these routines into your namespace, you can call them as: use HTML::Entities (); $decoded = HTML::Entities::decode($a); $encoded = HTML::Entities::encode($a); $encoded = HTML::Entities::encode_numeric($a); The module can also export the %char2entity and the %entity2char hashes, which contain the mapping from all characters to the corresponding entities (and vice versa, respectively). COPYRIGHT
Copyright 1995-2006 Gisle Aas. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-10-15 HTML::Entities(3pm)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy