Questions tagged [encode]

1

votes
1

answer
49

Views

How do I add characters to an encoded string? Python

I need to send a request from the backend I'm doing in Python to an API via URL. The method requests.get(URL) automatically makes the respective encoding to UTF-8. The problem is that the API page, when they are special characters, such as in Russian, German, Spanish, etc.... in the address goes th...
Andres Martinez
1

votes
0

answer
42

Views

How do I properly return sanitized data to Javascript application from php?

There's a lot of information on how to sanitize data, but I can't find anything on returning sanitized data. I have user input going into my database so I sanitize it, but now I'm returning it to my application and feel like the whole point of sanitizing is so no injection or anything happens on the...
DJSweetness
1

votes
1

answer
329

Views

Swift Declare generic type that conforms to a certain protocol in a dictionary [duplicate]

This question already has an answer here: Store Encodables in a Swift Dictionary 2 answers I am using this function public mutating func encodeIfPresent(_ value: T?, forKey key: KeyedEncodingContainer.Key) throws where T : Encodable to encode a entity But my entity contains a dictionary which I al...
Wstunes
1

votes
1

answer
485

Views

Reading pdf using pyPDF2 with polish characters

I'm trying to use PyPDF2 library for reading a pdf file which consists of polish characters (for example ń, ś, etc), but after using extractText() function, the output string lacks of polish chars. Is there any way to still use PyPDF2 library but firstly properly encode, decode pdf file? I was try...
kgr
1

votes
1

answer
115

Views

How to decode HEX code to regular text in Apple Script

I'm using the todo list app Things from Cultured Code on my Mac and when I copy a link to a task to clipboard it ends up encoded as HEX code in the clipboard. No problem when I paste it into a text file – it then shows as decoded text. But, I need to use the clipboard content in an AppleScript and...
iLoveCode
1

votes
0

answer
35

Views

How to properly write an 'If in' statement for an encoded string?

I'm trying to take the string hello, encode it into hexadecimal, and then print success if the value of t is found in the encoded string. This is what I have currently: import codecs t='68656c6c6df' pkts = ('hello') pkts1 = codecs.encode(b'hello', 'hex_codec') if 't' in pkts1: print ('success') Whi...
Keondre
1

votes
0

answer
35

Views

Reading file unicode and converting to english Python

Im currently having some troubles reading a file with Python 3. When I open the file as plain text, I can read the following text: sadfdasfsafasdf,asdfdasfdsafdasfdasf,asdfasfasddfa,asfdasfadd However when I read the file with the following code (I used these lines to read other text files and it wo...
chuseuiti
1

votes
0

answer
251

Views

Is there built-in support for automatically escaping invalid HTTP Header characters in .NET Core?

In .NET Framework, there is the method System.Web.Util.HttpEncoder.HeaderNameValueEncode() to (as the name suggests) encodes characters (such as newlines) that would be invalid in HTTP Headers so that they are appropriately escaped. Is there an equivalent method in .NET Core? I'm aware of System.Te...
Interminable
1

votes
0

answer
161

Views

Picture encoding and decoding with python

First, I got three integer p1, p2, p3. Then for each pixel, I got r, g, b value and changed it to r * (3 ^ p1) % 256, g * (3 ^ p2) % 256, b * (3 ^ p3) % 256. That was my encoding and to decode this, for each pixel in encoded picture, I got r, g, b value and changed it to r * (3 ^ key1) % 256, g * (3...
Suh Myung Kyo
1

votes
0

answer
35

Views

Pycharm debugger watch UnicodeEncodeError

Versions are: PyCharm 2018.1.2 (Professional Edition) Python 2.7 Python 3.6 test.py # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys print(sys.getdefaultencoding()) d = {'中文': '中文'} print(d) When you run python test.py, the output is ascii {u'\u4e2d\u6587': u'\u4e2...
Simin Jie
1

votes
0

answer
14

Views

Alternate way to send a ISO-8859-6 encoded requset to a server instead of Node.js, since Node.js does not support it

I am trying to send a request with some ISO-8859-6 encoded data with requestjs which is not possible since Node does not support that encode. I have done some other requests to that server before doing this one and update the Cookie everytime. I was trying to send that request via PHP or CURL but I...
user3313781
1

votes
0

answer
44

Views

in Python 3, after encode('utf-8'), variable length changes from 2 to 4

I am converting Python 2 codes to Python 3, and need to convert str to bytes using encode(). let the str variable's name s1. set the unicode using # -*- coding: utf-8 -*- at the benigning of the *.py file. in Python 2: type(s1)=, len(s1)=2; in Python 3: type(s1)=, len(s1)=2; type(s1.encode())=, bu...
Zheng
1

votes
0

answer
29

Views

How to upload an XML file via API Gateway and maintain file encoding

I'm having issues uploading XML files via the API Gateway to S3 while maintaining the encoding, which in this case is windows-1250 (long story). What is happening, is that the XML file is uploading to the S3 bucket, but encoded as UTF-8, which breaks a decoding we need to achieve later in the flow....
wingman
1

votes
0

answer
60

Views

Resaving a UserDefaults value for key gives error in swift 4

I have a custom System object, which has a expenses variable (of type [Int : (String, Double)]), that i store in UserDefaults. After I retrieve it, if the user wants to add something to expenses, i overwrite the old UserDefaults value. Here's the code for storing the value: class System: NSObject,...
Fayyouz
1

votes
2

answer
344

Views

Uri.encode() encodes wrong

So, I need to encode my url. For that I use Uri.encode(): private const val CHARS= '@#&=*+-_.,:!?()/~'%' if (query != null) { query = Uri.encode(query, Chars) } But, it encodes weirdly... [ is %255B, when it should be and ] is %255D, when it should be %5D Update: Turns out Uri.encode() works ju...
PeteWonder
1

votes
1

answer
35

Views

Invalid byte 2 of 2-byte UTF-8 sequence: XML saved as String varible

I get the following error due to Latin text in my XML. Invalid byte 2 of 2-byte UTF-8 sequence: XML saved as String varible My XML is written to a String variable (I don't import a file). I tried to set encoding to 'UTF-8', but I might have done it wrong. Can you help please? My code: DocumentBui...
Roei Givati
1

votes
0

answer
183

Views

MYSQL 5.6 & 8.0 utf8mb4 : PHP 5.6 utf8

I have develop a web site using MySQL 8.0 (uft8mb4) and PHP 5.6 (UTF-8) Where no issues where raised for the INSERT or SELECT data in the DB. ex. the word 'sévère' would appear as is in both parties. The problem appeared when I transfered the web site online. Now using MySQL 5.6 (uft8mb4) and PHP...
David
1

votes
0

answer
50

Views

Convert ISO-2022-JP format text to Japanese characters using online editors.

I am looking for Online encoders or decoders which can covert the below text coming in SCTP to Japanese characters. ?ISO-2022-JP?B?GyRCJUYlOSVIJWEhPCVrLWItIxsoQg==?= Let me know if any java library is available to test as well. I have tried a few online editors but they donot seem to convert ISO-202...
1

votes
2

answer
39

Views

How to use chinese character as associate key in php7's mysqli query?

For my mysql database. mysql> show variables like 'character%'; +--------------------------+-------------------------------+ | Variable_name | Value | +--------------------------+-------------------------------+ | character_set_client | utf8...
scrapy
1

votes
1

answer
418

Views

Flutter how to save(re-encode) text overlay on video

I would like to implement feature like instagram story(only text overlay). I was able to come to the point where user can add some text on video like screen shot below(upper right icon starts entering text, upper left just back to previous page). After user put some text I want store the video into...
Daibaku
1

votes
0

answer
153

Views

How to decode utf-8 files from btoa(unescape(encodeURIComponent(file))) in Python?

I want to upload any file (Word, PDF, Image ...) with an HTML file input to a python server. With the help of snakecharmerb (Upload file as JSON to Python webserver) I can send the file by encoding it in the following way in JavaScript: function fileChange(event) { const file = event.target.files[0]...
cgdannie
1

votes
1

answer
26

Views

How to change filename's encode type?

I am going to change my filename's encode type from utf-8 to big5, and this is what I have so far: $path = 'stu_resume/104206002_87'; $result =iconv('utf-8', 'big5', $path); echo $result; echo mb_detect_encoding($result); Within the folder of 104206002_87, there are 2 files, which are 104206002_87_...
Lykas
1

votes
1

answer
34

Views

How to use Server.UrlEncode with the Mustache Template Engine?

I am trying to Encode a product SKU on our Product Filter Module. The problem I am experiencing is that the Detailed Product View uses the following code to retrieve the appropriate product information. The problem arises when an SKU has a forward slash. For Example, BD1115/35 the code below only de...
Tig7r
1

votes
0

answer
67

Views

Encode audio float opus c

I'm trying to encode & decode audio with opus, but when I'm running my code the function opus_encode_float return -1. int opuscode(float *sound) { unsigned char data[1000000]; int *error; int ini; opus_int32 rate = SAMPLE_RATE; int size = opus_encoder_get_size(CHANNELS); OpusEncoder *op = opus_enco...
Jacques Payen
1

votes
1

answer
169

Views

How to resolve encoding error on loading files?

I have encountered a problem in Android Studio. It seems like the error 'File was loaded in the wrong encoding:'UTF-8'' persists in 90% of my java files. I have made some upgrades: Gradle version -> 4.6 and Android plugin version -> 3.2.1 However, I don't think the upgrade is the problem. This thing...
Alex Tomei
1

votes
1

answer
186

Views

How to Loop Prorocess FFMpeg in Windows?

I want to install a watermark in all my videos. I have 25 videos. but I am tired when using ffmpeg 1 time 1 time. I want multi in 1 script. How to ? ffmpeg -i video01.mkv -i watermark.png -filter_complex 'overlay = 10: 10' output01.mkv ffmpeg -i video02.mkv -i watermark.png -filter_complex 'overlay...
Amy Bomer
1

votes
1

answer
50

Views

javascript encode text by escaping forward slash using backward slash

I have a text with which is a base 64 string and I wanted to encode that base64 code by escaping special character / using \/ . I have used encodeURIComponent and str.replace(/\//g, '\\/'); but it would get the string with the \/ if I illustrate more with an example base64string 'samplebase64/sa...
1

votes
1

answer
85

Views

Convert float type to two short (high & low bytes)

I transfer data through serial port. on decoding side. I'm coding on transferring side follow the code from receiving side. I must encode data from float type (4 bytes) to high part and low part (short type) then transfer them. I had the decoding code. What i must do on encoding side. I tried conv...
Vũ Quang Hòa
1

votes
0

answer
70

Views

Encode string as file path fragment in PHP

In PHP, the function urlencode() allows to encode a string as a url fragment, encoding all characters that might have a special meaning in a url. The encoding is reversible with urldecode(). I am looking for something similar for filesystem paths. urlencode() might already work here, but it seems mo...
donquixote
1

votes
0

answer
63

Views

loading .mat file into python causing 'buffer is too small for requested array' error

I have the following python code (its dummy data) import scipy.io as si data = [0 ,1] metadata = {'Location_City': {'loíza': '0'}} metadata_b = bytes(str(metadata), 'utf-8') result_dict = {'d':data, 'm': metadata_b} si.savemat('data.mat', mdict = result_dict) Notice the i with an accent in loíza....
Naz
1

votes
0

answer
36

Views

Encode letter to number

I feel like I am failing everything this semester. but I was wondering if you all could help me with a JS project. We have been tasked with essentially converting numbers to letters and vica versa using textareas in HTML. I was able to do the numbers to letters function, but am having difficulties g...
Nathan Contini
1

votes
1

answer
58

Views

How to make encode and decode functions as I want?

--encode function strToBytes(str) local bytes = { str:byte(1, -1) for i = 1, #bytes do bytes[i] = bytes[i] + 100 end return table.concat(bytes, ',') end --decode function bytesToStr(str) local function gsub(c)return string.char(c - 100) end return str:gsub('(%d+),?', gsub) end implemented : str = 'h...
Red Starksten
1

votes
2

answer
47

Views

encode and decode strange .shm file data to and from base64 c#

first a depressing fact: https://www.base64decode.org/ can do what i want to do. i´m trying to encode and decode (to and from base64) a model file (.shm) generated by the image processing tool MVTec Halcon because i want to store it in a xml file. If i open it, it has this strange form: HSTF ÿÿ...
Michel
1

votes
1

answer
18

Views

Why linkedin widget on .net site renders junk characters?

We have a linkedin follow button widget on site.It works as expected in English language but when we choose location of machine (from control panel) to Sweden and set default primary language of Google chrome to 'Svenksa' it renders text with junk characters 'Följ'. Tried to set encoding using m...
user8551677
1

votes
1

answer
236

Views

NSString converting percentage characters

I have an NSString *str = @'T%B3%C3%83'; where %C3 represents A with an umlut (I think), %B3 an m, %83 a superscript 3... What is the best way to convert these percentages into the actual characters. Thanks.
Dave
1

votes
3

answer
9.9k

Views

HttpUtility.HtmlDecode driving me crazy

This situation is driving me crazy!!: the following snippet does not work (as i should) ... string preResult = doc.DocumentNode.SelectSingleNode('//textarea[@name='utrans']').InnerText return HttpUtility.HtmlDecode(preResult); ... The first line assigns a value (e.g.) '<b> Dummy value: </ b> in...
1

votes
2

answer
1.1k

Views

Wrap an ASP.NET control with double quotes

I'm working in a Repeater over blog posts and I'm displaying a ShareThis JavaScript piece at the bottom. The Title and URL of the post are being sent to JS. In one test case, the title of a post has a single quote, e.g. Mark's test post Since I need to preserve that single quote when being sent to S...
Mark Ursino
1

votes
1

answer
553

Views

How to create function for FFmpeg lib to encode frame into any (possible) format?

So how to create something which would have something like this in its api: Encoder = EncoderFormat(format name); // prepare encoder //...code for frames generation... now we want to encode frame!// EncodeFrame(const CImage* src, void* dest, int* is_keyframe, more args if needed); Is it possible? Pl...
Rella
1

votes
1

answer
693

Views

Asp.net MVC Markdown editor and Html.Encode

I might be mis-understanding here but from my understanding a markdown editor strips out all html. After then using a markdown.Transform() type of method this database stored markdown is converted into html with h1, p etc. With asp.net MVC the general rule is Html.Encode everything. But does this st...
asn1981
1

votes
1

answer
808

Views

encodeWithCoder Not getting called

I have an object (testSession) that complies to NSCoder and when I use: [NSKeyedArchiver archiveRootObject:testSession toFile:filename]; It has: @interface Session : NSObject { and has encodeWithCoder: and initWithCoder: functions. Neither are getting called. What would prevent this? - (void)encode...
Dane Man

View additional questions