Programming :: Filter ASCII Characters PHP?

Mar 8, 2010

How can I filter ASCII quotes( ' ) and double quotes ( " ) so that I can replace them with the UTF-8 equivalent?If I copy text from a Word Document(ASCII), and upload it to a web page with PHP. The Database(UTF-8) will replace these racters with incorrect character(s).I need some function that will replace these characters but I don't know how to differentiate the ASCII quotes and the UTF-8 Quotes without (somehow) converting the string to hex, then preg_replace'ing the hex code for the symbol.

View 8 Replies


ADVERTISEMENT

Programming :: Not Reading Non-ASCII Characters

Apr 26, 2010

Well, I have a web application in Linux server. All my Java codes are there. FYI, whenever user entered non-ASCII characters(e.g. ∞,�,�) in a text field in my web application, and I check the log of my Java code in Linux server, it returns weird characters.

Suppose user entered ∞ in the text field. I should get ∞ in my log too. However, I got weird characters in return.

View 14 Replies View Related

Programming :: Print All ASCII Characters In C#?

Mar 9, 2011

i want to print all ASCII characters kind of like a table, but i really don't have an idea of how to do it, i don't know if there is a built-in method or something to accomplish this, if not

View 2 Replies View Related

Ubuntu :: Delete All ASCII Characters In File - Leave Chinese Characters Only

Jul 8, 2011

What command could I use in terminal to delete all ASCII characters? That is, delete a-z, A-Z, 0-9, and all punctuation? I have a file containing Chinese characters, and I want to remove everything else and leave just the Chinese.

I can use grep to leave only the lines that have Chinese in them, but this still leaves a lot of non-Chinese stuff on those lines. Does anyone know how I could actually remove everything that isn't Chinese?

View 4 Replies View Related

General :: How To Use Extended ASCII Characters

Apr 6, 2010

How can I use extended ascii characters, like ALT + 2 + 0 + 0 for instance? I'm using some of those characters for my passwords for online accounts made under MS Windows and it seams I'm unable to use them in Slackware 13. For instance: if I type ALT+2+0+0 in Pidgin there is no character displayed and if I type in the Terminal the same thing, it will replace my shell prompter (sasser@HOSTA:~$) with (arg: 200):
sasser@HOSTA:~$
(arg: 200)

View 2 Replies View Related

Ubuntu :: Bash - Shift Ascii Characters Up Or Down One

Feb 20, 2010

Say you wanted to write a bash script for "hello world" but the characters were shifted up or down by one.

How would one go about this?

Example:

Code:

Code:

View 5 Replies View Related

Ubuntu :: Compression Excluding Certain Ascii Characters?

Jun 8, 2011

I am working on a project where I am dialing out of a modem!! Old stuff, ya, but the modem allows my device send info from remote sites from my datibase through a phone line so that this IT departments dont have to worry my device being a security issue on their networks.

Any way, the modem I'm using isn't incredibly well designed, and when a certain ascii char is read by the modem, it reads it as an EOF indicator. It is also important that the files I send are compressed.

My question is: Does anyone know of a compression format that allows ME to dissallow IT's use of certain ascii chars?

just as an illustration:

Device --------> Modem ---------> Off-site

and the Modem stops talking to the device when a certain char is passed to it.

View 1 Replies View Related

Ubuntu Multimedia :: Cover Art In Banshee For Tracks With Non ASCII Characters

Jan 16, 2010

Banshee (Version 1.5.2) doesn't seem to support cover art for tracks that include non ascii characters in any way. All manual methods that work with ascii tracks failed (folder.jpg in album folder, copying appropriately named jpg in ~/.cache/album-art, embedding jpg in mp3 metadata). This is really quite a drawback for users who don't have an English-only music collection. Is there any workaround or bugfix that I missed or do I have to go back to Rhythmbox to have non-English cover art?

View 1 Replies View Related

Slackware :: Amarok Refusing To Play Songs That Have Any Non-ascii Characters

Jun 25, 2010

I'm stuck with the problem of amarok refusing to play songs that have any non-ascii characters in the metadata, which is about 1/3 of my collection.A solution to that problem would be ideal, but if there is a good alternative (like amarok 1.x series) I would probably switch.

View 5 Replies View Related

Software :: Filter Printed Line To Get Characters Between 2 Expressions?

Jan 28, 2011

I'm having trouble getting a sed command to work. I need to filter a printed line to get characters between 2 expressions. "<job>" and "<url>".

Code:
echo "<job>TEST<url>http://www.project.com/?code=001" | sed 's/^[<job>]*//' | sed 's/[<url>]*$//'
Produces:
Code:
TEST<url>http://www.project.com/?code=001

It takes off the first part but why is that not deleting the "<url>" and all the parts after that?

View 9 Replies View Related

Programming :: Qt Conversion From Ascii To QString?

Aug 25, 2010

I'm working on a Qt program and when it gets to the following line of code I get a seg fault:

QString blah = QString::fromAscii(entry->d_name, 256);

entry->d_name is a 256 byte character array returned by readdir(), I would expect this line of code to convert that character array from ascii to a QString, but I get a seg fault and I'm not entirely sure why..

View 2 Replies View Related

Programming :: Output Data To An Ascii Table?

Oct 18, 2010

I've got lines of data in the following format:
space1=number of times error has occured
space2=IP address
space3=Error

I've set this out nicely with printf and made it email me, the problem is - it's not entirely clear what each column/space is and the IP and occurances can sometimes seem confusing. Is there any (easy) way to output this into an ascii like table? There will always be 5 occurances, and the format will always be the same

View 1 Replies View Related

Programming :: Prepend To ASCII Text File In C?

Jun 15, 2010

To start off I would like to acknowledge that I am not a very good C programmer and pretty much everything I know has been self taught through mostly trial and error. So forgive me if there is an obvious answer to my question, or if I don't immediately grasp the concepts involved in the possible solution.

Basically, I'm writing an application which will be creating log file entries rather rapidly (potentially hundreds per minute), and I would like each new line to appear at the top of the log file, rather than the end. Opening a text file in append mode is easy enough, but I can't seem to find any obvious way to do the opposite.

I have been looking online and it seems that there exists no standard way to do this, and I have only been able to find a few mentions of how somebody might achieve it. The most common method seems to be using two files and copying the data back and forth between them. This seems like it would be insanely I/O intensive with the number of lines I'm likely to be generating. If this is the best method to use, I will give it a shot; though I am not 100% clear on how to implement it, I am also open to any other ideas as to how to accomplish this, and I don't have to worry about portability since the program already uses Linux-only libraries. So calling out to sed or something is not necessarily out of the question (though I imagine performance would also be an issue there).

View 4 Replies View Related

Programming :: Checking Function - Character ASCII Or Unicode

Jan 20, 2009

To know the function on checking whether a character is ascii or unicode character. From the following [uRL]. The function IsTextUnicode is related to Windows VC++ library. I would like to know the library/function which provides such facility.

View 2 Replies View Related

Programming :: Convert Multiple File In Directory - Ascii To Hex In Perl ?

Apr 9, 2011

I have found a perl script that can convert single file: ascii to hex.

However I have thousand of file that I want to convert from ascii to hex.

Here is the perl script that convert single ascii file to hex in single line:

Quote:

So I would like to read multiple file from a directory.

Then the file will be have same name file with hex data.

Here is sample of the read and write directory file.

Quote:

View 3 Replies View Related

Programming :: Bash: Using Grep To Filter 25 Or Above?

Dec 3, 2010

i have a sample that looks like this:

Code:
[schneidz@hyper temp]$ wget -q --output-document=- http://world.needforspeed.com/SpeedAPI/ws/game/nfs-w/leaderboards/events

[code]....

View 2 Replies View Related

Programming :: Filter Last 24 Hour Data And Put In New File?

Aug 30, 2010

i have file server 1 (filesvr01acess.log) and disc server 1 (discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.81)
Similiarly i have file server 2 (filesvr01acess.log) and disc server 2(discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.82). Now my requirement is write sheel script for ..

1. I need only last 24 hour data out of the file server 1 and file server 2 and then finaly put this data in one new file

2. Similiarly same need for discserver 1 and discserver 2.

FYI, each .log files mentioned above is nicely order as date and time as it is created. I can view through cat or search by using grep comand in unix I am wondering if we can achieve through grep command in unix

View 1 Replies View Related

Programming :: Numpy 'filter' Type Function?

Jan 27, 2010

I'm a n00b to both numpy and python. I was wondering what the most intelligent way to write the trapezoid rule function was:

Code:
>>> import numpy as np
>>> a=np.array([1,2,3,4,5])
>>> def mytrapz(vec):
total=0
for i in xrange(0,len(vec)-1):
total+=(vec[i]+vec[i+1])/2.0
return total

>>> mytrapz(a)12.0 This is exactly what I would do in C and I'm sure the for loop is not the fastest way (as is the case for my interpreted langs). Yes, I know there is already numpy.mytrapz... I'm interested in the most efficient way to loop over arrays in such a way that each iteration accesses more than one cell.

View 1 Replies View Related

Programming :: Filter Out The Additional Packages That Exist On A New Server?

Apr 15, 2010

I've got two files. They both contain package names. Is there any way I can go through the package list on one file, and search to see if each package exists in the other file? What I'd want to do, is if the package name is found in the the main file, then go to the next line. If its not found then print that package name to another file.

I know you can use diff, but it doesn't seem to be that straight forward. As I understand it diff searches line by line, so if line one doesn't match line one in another file, then it prints it out. That's not exactly what I want.

I just really need an easy way to filter out the additional packages that exist on a new server. If I have a list of packages that aren't on the original server, then i can just delete them.

Not sure if I've made any sense but there must be a quicker way to do what i need to. It would take me ages to scan manually through the package names in each list, and highlight the ones i dont need.

View 2 Replies View Related

Programming :: Find Syntax Exclude Certain Extensions And Filter By Age

May 26, 2010

I'm trying to find all the files in a specified directory that do NOT end in .archived or .error and are older than 30 mins. Currently I have: Code: find /opt/edi/incoming -type f ! ( -name "*.archived" -name "*.error" ) -cmin 30 But I keep returning files that end in those extensions and I'm not sure if I'm using -cmin correcty? If there is a better way to do this (perl, etc) I'm open to options, this is for a nagios check.

View 2 Replies View Related

General :: Filter Script Files In Bash Programming?

Feb 10, 2010

I'm building my first BASH programs and I have a hard time. I can't do a search in a folder and filter only script files without extension, the problem is to differentiate the script files from the others. I tried with ls I tried with find and i don't find a way to make it work.

View 8 Replies View Related

Programming :: JFileChooser : Setting The Default 'file Filter'

Sep 28, 2010

Code:

// create a filechooser;
JFileChooser chooser = new JFileChooser(cwd);
FileNameExtensionFilter filter = new FileNameExtensionFilter(
"sdf files (*.sdf)", "sdf");

[code]....

This will give 3 filefilters ('all files', 'sdf files' and 'xml files') for a fileopen dialog. Exactly as I want (in alphanumerical order), but XML is the default extension and I like SDF to be the default extension. Research has not revealed solutions; the setFileFilter method sets the primary filter. If I swap the sequence in the code, SDF becomes the default (as I want) but the sequence is wrong (All, XML, SDF).

View 3 Replies View Related

Programming :: Unable To Exclude Lines And Bad Filter Within AWK Script

Apr 29, 2010

Looking for some help to fix 2 problems I have in my script. (I�m using bash on cygwin)I have the following source file ($7 does not have data):

Code:

HEADER_1,HEADER_2,HEADER_3,HEADER_4,HEADER_5,HEADER_6,HEADER_7
pattern2,pattern7/Sub data1/Sub data2,pattern8,pattern9,pattern2,pattern2,
pattern3,pattern6/Sub data1/Sub data2,pattern7,pattern3,pattern5,pattern1,

[code]....

In line 5 of the script, that is " {$2 !~ /pattern4|pattern5|pattern6/ }" oriented to delete lines containing pattern4, pattern5 and pattern6 from column 2 it seems not to be working. If I see the output, the line highlighted in red, is present and should not appear, because this line does not contain nor HEADER nor pattern1 nor pattern2.

View 7 Replies View Related

Programming :: Unknown Filter Error - Option Rate Unparsable

Feb 21, 2010

I am getting this error "Unknown filter "police", hence option "rate" is unparsable. This is in Linux Kernel 2.6 which is compiled with the "policing" option enabled in Qos (Kernel config). The error seems to be coming from the file tc.c in iproute2/

static int parse_nofopt(struct filter_util *qu, char *fhandle, int argc, char **argv, struct nlmsghdr *n) {
__u32 handle;
if (argc) {
fprintf(stderr, "Unknown filter "%s", hence option "%s" is unparsable
", qu->id, *argv);
return -1;
} if (fhandle) {
struct tcmsg *t = NLMSG_DATA(n);
if (get_u32(&handle, fhandle, 16)) {
fprintf(stderr, "Unparsable filter ID "%s"
", fhandle);
return -1; }
t->tcm_handle = handle; }
return 0; }

This is called from get_filter_kind() which is called from tc_filter_modify(), called from do_filter(), from do_cmd() from main()...all in tc.c. Is this a known "bug" in iproute2+2.6 as the 2.4 Kernel works with the same settings?

View 14 Replies View Related

Programming :: Extra "10" Printed After Every Conversion From ASCII To Int?

Dec 1, 2009

I have a very basic program which I wrote, to print the integer equivalents of an ASCII character. The code is below:

Code:

#include<stdio.h>
int main(void)
{
char c;

[code]....

The code is supposed to take a character as input and print the integer equivalent of that character. But the problem is that, after printing the integer equivalent, it prints an extra '10', every time.

Code:

f
102
10

[code].....

Why does this extra '10' always come? When the code is just a simple:

Code:

#include<stdio.h>
int main(void)
{

[code]....

The code works just fine. There is no extra '10' displayed. I am using Ubuntu 9.10 with gcc-4.4.1.

View 4 Replies View Related

Programming :: Control Characters In C

Feb 16, 2009

I'm working on my ncurses application, written in C. I get user input through a loop which uses getchar(). I was able to recognize Ctrl-n by comparing the keypress to ASCII character 16, and this seems to work fine. However, if I noticed that the ASCII character for Ctrl-j (10) is the same as the Line Feed. I tested this, and if I press enter on the keyboard I get the same ASCII value as when I press Ctrl-j.

So, what do I do if I want Ctrl-j to mean something different in my program than pressing enter?The ncurses terminal mode is set to raw, with a 100 millisecond timeout, and keypad is on (I'm already using the up and down arrow-keys).

View 1 Replies View Related

Programming :: How To Do An Array Of Characters

Feb 18, 2010

I am trying to create an array containing all ASCII characters, how do I create one:

Code:
#!/bin/bash
CHARLIST=( a b c d e f g h i j k l m n o p q r s t u v w x y z

[code]...

View 6 Replies View Related

Programming :: Scramble Characters In AWK?

May 12, 2010

I see I'm finally posting an AWK question rather than an answer for a change I wanted to make an AWK script that would scramble all the characters in each field, but leave the first and last characters where they were.

View 14 Replies View Related

Programming :: How To Truncate Last Two Characters If Its '_1'

Mar 17, 2010

In a file i have to grep for a particular word and cut 8 characters of that word and replace the last characters with space if it is _1.Eg: HP4350_1..i did grep|cut -c 2-9|but didn't know how to truncate the last two characters if its '_1'.i used tr '[_1] '[ ]'.but it replaced all the characters where there is a 'underscore' and 1 instead of'_1' together.

View 5 Replies View Related

Programming :: Stripping Characters Before '=' Delimiter In PHP?

Aug 15, 2010

I'm trying to make a webpage that will display the bash variables I have in a file. These variables are used in a bash script that is run from on my server.The file looks like this:

SERVER=canfs01
SHARE=public
USERNAME=guest

[code]....

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved