mediastreamvalidator showing "Illegal MIME type" `application/x-mpegURL` - http-live-streaming

I ran an m3u8 manifest through mediastreamvalidator and then through hlsreport and the first error under "Must Fix Issues" is this:
1. Illegal MIME type
All Variants, MIME type: application/x-mpegURL
All Renditions, MIME type: application/x-mpegURL
Master Playlist, MIME type: application/x-mpegURL
I'm a bit confused because application/x-mpegURL is the apple-recommended MIME type for m3u8 streams. How do I make sense of this?

Same here, I think only audio/mpegURL and application/vnd.apple.mpegURL are accepted by the program.

Related

How to convert Response content type from 'ISO-8859-1' to 'UTF-8'

We are using NodejS for our application. One of the external service is returning a response as content type - 'text/plain;charset=ISO-8859-1'. The response is something like this.
{"name","I contain special character" ,other filed....}.
The problem with this is for some request name contain special character inside. So this is breaking our system. we are looking for a way if the name in response contain special character than convert the name into UTF-8 format.
I already tried setting these to headers.
dataType: "json",
contentType: "application/json;charset=utf-8",
But it is still not working. Can someone please help with a workaround or any solution ?

Problem with Python type hinting and standard libs

The following code works as expected, but the os.path.join produces a type error using pyright in VSCode, where shown.
# python 3.6.9
# pyright 1.1.25
# windows 10
# vscode 1.42.1
import os
import tempfile
with tempfile.TemporaryDirectory() as tmpfolder:
name = "hello.txt"
path = os.path.join(tmpfolder, name)
# No overloads for 'os.path.join(tmpfolder, name)' match parameters
# Argument types: (TypeVar['AnyStr', str, bytes], Literal['hello.txt'])
print(path)
I think I understand the immediate cause of the problem, but contend it should not be happening. Given that, I have some questions:
Is this the idiomatic way to write this code?
Is the problem in tempfile, os, pyright, or me?
If I cannot upgrade Python, what is the best (i.e. least clunky) way to suppress the error?
This seems like a limitation of pyright.
In short, the tempfile.TemporaryDirectory class is typed to be generic with respect to AnyStr. However, your example code omits specifying the generic type, leaving it up to the type checker to infer something appropriate.
In this case, I think there are several reasonable things for a type checker to do:
Pick some default generic type based on the typevar, such as 'str' or 'Union[str, bytes]'. For example, mypy ends up picking 'str' by default, giving 'tmpfolder' a type of 'str'.
Pick some placeholder type like either 'Any', the dynamic type, or NoReturn (aka 'bottom' aka 'nothing'). Both types are a valid subtype of every type, so are guaranteed to be valid placeholders and not cause downstream errors. This is what pyre and pytype does -- they deduce 'tmpfolder' has type 'Any' and 'nothing' respectively.
Attempt to infer the correct type based on context. Some type checkers may attempt to do this, but I don't know of any that handles this particular case perfectly.
Report an error and ask the user to specify the desired generic type.
What pyright seems to do instead is to just "leak" the generic variable. There is perhaps a principled reason why pyright is deciding to do this that I'm overlooking, but IMO this seems like a bug.
To answer your other questions, your example program is idiomatic Python, and type checkers should ideally support it without modification.
Adding a # type: ignore comment to the line with the error is the PEP 484 sanctioned way of suppressing error messages. I'm not familiar enough with pyright to know if it has a different preferred way of suppressing errors.

Decode file names from MIME messages with LotusScript

I am parsing a MIME mail with LotusScript to get all attachments. But I get issues when it comes to encoded file names in the header. I got one file with the name
"HE336 =?Windows-1251?Q?=CF=E0=EA=E5=F2_=E4=EE=EA=F3=EC=E5=ED=F2=EE=E2.pdf?="
Is there any way to decode it with LotusScript?
The string I get is RFC 2047 header encoding. I found that Notes supports it in MIME headers. The issue I had is when I used MIMEHeader.GetParamVal it always returns the encoded value. However MIMEHeader.GetHeaderVal and GetHeaderValAndParams has an extra parameter
boolean decoded
true decodes any RFC-2047 encodings
false (default) retains any encodings; false is enforced if folded is true
When this is set to true, I get a decoded value.
it's been a while but I once used Julian Robichaux's Base64 classes with Jave and/or LS. You should be able to achieve what you are looking for with these.
Base64Encoding
Hope that helps.
Best wishes - Michael

Unmarshalling with JAXB leads to : javax.xml.bind.UnmarshalException (invalid byte sequence)

Here's my problem : I've written a program that unmarshals an XML file given as input and it turns out that my program works just fine on my development environment BUT this same program will yield the following exception on my client's environment :
javax.xml.bind.UnmarshalException
- with linked exception:
[java.io.UTFDataFormatException: Invalid byte 2 of 2-byte UTF-8 sequence.]
The XML file given as input to my program is using UTF-8 as encoding type. The Unmarshaller object is using the default encoding type, that is UTF-8, since I did not set any property value to it. Besides, I did not set a schema to the unmarshaller, so, I am not even requesting an XML validation.
Does anyone have any idea or has anyone already ran into the same problem?
Thanks in advance
I have already get this error. I have change my configuration to use ISO-8859-1 encoding :
marshaller.setProperty(Marshaller.JAXB_ENCODING, "ISO-8859-1");
i can put UTF-8 strings in the xml flow, it's correctly marshall/unmarshall even if the encoding is not define like ISO-8859-1

application/plain MIME type for text?

I have seen this application/plain mentioned with .text suffix in some sources. Is it valid and has it been used anywhere? Or is this just a case where someone compiled a list and others just copied it?
It isn't a valid MIME type according to the IANA: http://www.iana.org/assignments/media-types/application/index.html
Sadly, that doesn't mean you won't encounter it in the real world. ;-)

Resources